Add "Crash" entry to systray if started with --debug

This commit is contained in:
Dominik Schmidt 2014-08-26 15:46:24 +02:00
parent b176ff6626
commit 17e16f5e79
6 changed files with 40 additions and 2 deletions

View file

@ -87,7 +87,8 @@ Application::Application(int &argc, char **argv) :
_showLogWindow(false), _showLogWindow(false),
_logExpire(0), _logExpire(0),
_logFlush(false), _logFlush(false),
_userTriggeredConnect(false) _userTriggeredConnect(false),
_debugMode(false)
{ {
// TODO: Can't set this without breaking current config pathes // TODO: Can't set this without breaking current config pathes
// setOrganizationName(QLatin1String(APPLICATION_VENDOR)); // setOrganizationName(QLatin1String(APPLICATION_VENDOR));
@ -285,6 +286,11 @@ void Application::slotToggleFolderman(int state)
} }
void Application::slotCrash()
{
Utility::crash();
}
void Application::slotConnectionValidatorResult(ConnectionValidator::Status status) void Application::slotConnectionValidatorResult(ConnectionValidator::Status status)
{ {
qDebug() << "Connection Validator Result: " << _conValidator->statusString(status); qDebug() << "Connection Validator Result: " << _conValidator->statusString(status);
@ -404,6 +410,8 @@ void Application::parseOptions(const QStringList &options)
} else { } else {
showHelp(); showHelp();
} }
} else if (option == QLatin1String("--debug")) {
_debugMode = true;
} else { } else {
setHelp(); setHelp();
break; break;
@ -455,6 +463,11 @@ void Application::showHelp()
displayHelpText(helpText); displayHelpText(helpText);
} }
bool Application::debugMode()
{
return _debugMode;
}
void Application::setHelp() void Application::setHelp()
{ {
_helpOnly = true; _helpOnly = true;

View file

@ -48,6 +48,7 @@ public:
bool giveHelp(); bool giveHelp();
void showHelp(); void showHelp();
bool debugMode();
public slots: public slots:
// TODO: this should not be public // TODO: this should not be public
@ -81,6 +82,7 @@ protected slots:
void slotAccountChanged(Account *newAccount, Account *oldAccount = 0); void slotAccountChanged(Account *newAccount, Account *oldAccount = 0);
void slotCredentialsFetched(); void slotCredentialsFetched();
void slotToggleFolderman(int state); void slotToggleFolderman(int state);
void slotCrash();
private: private:
void setHelp(); void setHelp();
@ -101,6 +103,7 @@ private:
int _logExpire; int _logExpire;
bool _logFlush; bool _logFlush;
bool _userTriggeredConnect; bool _userTriggeredConnect;
bool _debugMode;
ClientProxy _proxy; ClientProxy _proxy;

View file

@ -350,6 +350,11 @@ void ownCloudGui::setupContextMenu()
if (!Theme::instance()->helpUrl().isEmpty()) { if (!Theme::instance()->helpUrl().isEmpty()) {
_contextMenu->addAction(_actionHelp); _contextMenu->addAction(_actionHelp);
} }
if(_actionCrash) {
_contextMenu->addAction(_actionCrash);
}
_contextMenu->addSeparator(); _contextMenu->addSeparator();
if (isConfigured && isConnected) { if (isConfigured && isConnected) {
_contextMenu->addAction(_actionLogout); _contextMenu->addAction(_actionLogout);
@ -424,6 +429,13 @@ void ownCloudGui::setupActions()
_actionLogout = new QAction(tr("Sign out"), this); _actionLogout = new QAction(tr("Sign out"), this);
connect(_actionLogout, SIGNAL(triggered()), _app, SLOT(slotLogout())); connect(_actionLogout, SIGNAL(triggered()), _app, SLOT(slotLogout()));
if(_app->debugMode()) {
_actionCrash = new QAction(tr("Crash now"), this);
connect(_actionCrash, SIGNAL(triggered()), _app, SLOT(slotCrash()));
} else {
_actionCrash = 0;
}
} }
void ownCloudGui::slotRefreshQuotaDisplay( qint64 total, qint64 used ) void ownCloudGui::slotRefreshQuotaDisplay( qint64 total, qint64 used )

View file

@ -99,6 +99,7 @@ private:
QAction *_actionRecent; QAction *_actionRecent;
QAction *_actionHelp; QAction *_actionHelp;
QAction *_actionQuit; QAction *_actionQuit;
QAction *_actionCrash;
QList<QAction*> _recentItemsActions; QList<QAction*> _recentItemsActions;

View file

@ -361,6 +361,12 @@ bool Utility::isLinux()
#endif #endif
} }
void Utility::crash()
{
volatile int* a = (int*)(NULL);
*a = 1;
}
void Utility::winShellChangeNotify( const QString& path ) void Utility::winShellChangeNotify( const QString& path )
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN

View file

@ -76,6 +76,9 @@ namespace Utility
OWNCLOUDSYNC_EXPORT bool isUnix(); OWNCLOUDSYNC_EXPORT bool isUnix();
OWNCLOUDSYNC_EXPORT bool isLinux(); // use with care OWNCLOUDSYNC_EXPORT bool isLinux(); // use with care
// crash helper for --debug
OWNCLOUDSYNC_EXPORT void crash();
// Case preserving file system underneath? // Case preserving file system underneath?
// if this function returns true, the file system is case preserving, // if this function returns true, the file system is case preserving,
// that means "test" means the same as "TEST" for filenames. // that means "test" means the same as "TEST" for filenames.