зеркало из https://github.com/nextcloud/desktop.git
Add "Crash" entry to systray if started with --debug
This commit is contained in:
Родитель
b176ff6626
Коммит
17e16f5e79
|
@ -87,7 +87,8 @@ Application::Application(int &argc, char **argv) :
|
|||
_showLogWindow(false),
|
||||
_logExpire(0),
|
||||
_logFlush(false),
|
||||
_userTriggeredConnect(false)
|
||||
_userTriggeredConnect(false),
|
||||
_debugMode(false)
|
||||
{
|
||||
// TODO: Can't set this without breaking current config pathes
|
||||
// setOrganizationName(QLatin1String(APPLICATION_VENDOR));
|
||||
|
@ -285,6 +286,11 @@ void Application::slotToggleFolderman(int state)
|
|||
|
||||
}
|
||||
|
||||
void Application::slotCrash()
|
||||
{
|
||||
Utility::crash();
|
||||
}
|
||||
|
||||
void Application::slotConnectionValidatorResult(ConnectionValidator::Status status)
|
||||
{
|
||||
qDebug() << "Connection Validator Result: " << _conValidator->statusString(status);
|
||||
|
@ -404,6 +410,8 @@ void Application::parseOptions(const QStringList &options)
|
|||
} else {
|
||||
showHelp();
|
||||
}
|
||||
} else if (option == QLatin1String("--debug")) {
|
||||
_debugMode = true;
|
||||
} else {
|
||||
setHelp();
|
||||
break;
|
||||
|
@ -455,6 +463,11 @@ void Application::showHelp()
|
|||
displayHelpText(helpText);
|
||||
}
|
||||
|
||||
bool Application::debugMode()
|
||||
{
|
||||
return _debugMode;
|
||||
}
|
||||
|
||||
void Application::setHelp()
|
||||
{
|
||||
_helpOnly = true;
|
||||
|
|
|
@ -48,6 +48,7 @@ public:
|
|||
|
||||
bool giveHelp();
|
||||
void showHelp();
|
||||
bool debugMode();
|
||||
|
||||
public slots:
|
||||
// TODO: this should not be public
|
||||
|
@ -81,6 +82,7 @@ protected slots:
|
|||
void slotAccountChanged(Account *newAccount, Account *oldAccount = 0);
|
||||
void slotCredentialsFetched();
|
||||
void slotToggleFolderman(int state);
|
||||
void slotCrash();
|
||||
|
||||
private:
|
||||
void setHelp();
|
||||
|
@ -101,6 +103,7 @@ private:
|
|||
int _logExpire;
|
||||
bool _logFlush;
|
||||
bool _userTriggeredConnect;
|
||||
bool _debugMode;
|
||||
|
||||
ClientProxy _proxy;
|
||||
|
||||
|
|
|
@ -350,6 +350,11 @@ void ownCloudGui::setupContextMenu()
|
|||
if (!Theme::instance()->helpUrl().isEmpty()) {
|
||||
_contextMenu->addAction(_actionHelp);
|
||||
}
|
||||
|
||||
if(_actionCrash) {
|
||||
_contextMenu->addAction(_actionCrash);
|
||||
}
|
||||
|
||||
_contextMenu->addSeparator();
|
||||
if (isConfigured && isConnected) {
|
||||
_contextMenu->addAction(_actionLogout);
|
||||
|
@ -424,6 +429,13 @@ void ownCloudGui::setupActions()
|
|||
_actionLogout = new QAction(tr("Sign out"), this);
|
||||
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 )
|
||||
|
|
|
@ -99,6 +99,7 @@ private:
|
|||
QAction *_actionRecent;
|
||||
QAction *_actionHelp;
|
||||
QAction *_actionQuit;
|
||||
QAction *_actionCrash;
|
||||
|
||||
QList<QAction*> _recentItemsActions;
|
||||
|
||||
|
|
|
@ -361,6 +361,12 @@ bool Utility::isLinux()
|
|||
#endif
|
||||
}
|
||||
|
||||
void Utility::crash()
|
||||
{
|
||||
volatile int* a = (int*)(NULL);
|
||||
*a = 1;
|
||||
}
|
||||
|
||||
void Utility::winShellChangeNotify( const QString& path )
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
|
|
|
@ -69,13 +69,16 @@ namespace Utility
|
|||
*/
|
||||
OWNCLOUDSYNC_EXPORT QString timeToDescriptiveString(QList<QPair<QString,quint32> > &timeMapping, quint64 msecs, quint8 precision, QString separator, bool specific);
|
||||
OWNCLOUDSYNC_EXPORT QString timeToDescriptiveString(quint64 msecs, quint8 precision, QString separator, bool specific);
|
||||
|
||||
|
||||
// convinience OS detection methods
|
||||
OWNCLOUDSYNC_EXPORT bool isWindows();
|
||||
OWNCLOUDSYNC_EXPORT bool isMac();
|
||||
OWNCLOUDSYNC_EXPORT bool isUnix();
|
||||
OWNCLOUDSYNC_EXPORT bool isLinux(); // use with care
|
||||
|
||||
// crash helper for --debug
|
||||
OWNCLOUDSYNC_EXPORT void crash();
|
||||
|
||||
// Case preserving file system underneath?
|
||||
// if this function returns true, the file system is case preserving,
|
||||
// that means "test" means the same as "TEST" for filenames.
|
||||
|
|
Загрузка…
Ссылка в новой задаче