SettingsDialog::SettingsDialog(Application *app, QWidget *parent) : QDialog(parent), _ui(new Ui::SettingsDialog) { _ui->setupUi(this); setObjectName("Settings"); // required as group for saveGeometry call setWindowTitle(tr("%1 Settings").arg(Theme::instance()->appNameGUI())); QIcon generalIcon(QLatin1String(":/mirall/resources/settings.png")); QListWidgetItem *general = new QListWidgetItem(generalIcon, tr("General"), _ui->labelWidget); general->setSizeHint(QSize(0, 32)); _ui->labelWidget->addItem(general); GeneralSettings *generalSettings = new GeneralSettings; _ui->stack->addWidget(generalSettings); QIcon networkIcon(QLatin1String(":/mirall/resources/network.png")); QListWidgetItem *network = new QListWidgetItem(networkIcon, tr("Network"), _ui->labelWidget); network->setSizeHint(QSize(0, 32)); _ui->labelWidget->addItem(network); NetworkSettings *networkSettings = new NetworkSettings; _ui->stack->addWidget(networkSettings); connect(networkSettings, SIGNAL(proxySettingsChanged()), app, SLOT(slotSetupProxy())); connect(networkSettings, SIGNAL(proxySettingsChanged()), FolderMan::instance(), SLOT(slotScheduleAllFolders())); //connect(generalSettings, SIGNAL(resizeToSizeHint()), SLOT(resizeToSizeHint())); _accountSettings = new AccountSettings(this); addAccount(tr("Account"), _accountSettings); slotUpdateAccountState(); connect( app, SIGNAL(folderStateChanged(Folder*)), _accountSettings, SLOT(slotUpdateFolderState(Folder*))); connect( app, SIGNAL(folderStateChanged(Folder*)), SLOT(slotUpdateAccountState())); connect( _accountSettings, SIGNAL(addASync()), app, SLOT(slotFolderAdded()) ); connect( _accountSettings, SIGNAL(folderChanged()), app, SLOT(slotFoldersChanged())); connect( _accountSettings, SIGNAL(openFolderAlias(const QString&)), app, SLOT(slotFolderOpenAction(QString))); connect( _accountSettings, SIGNAL(openProgressDialog()), app, SLOT(slotItemProgressDialog())); connect( ProgressDispatcher::instance(), SIGNAL(progressInfo(QString, Progress::Info)), _accountSettings, SLOT(slotSetProgress(QString, Progress::Info)) ); connect( ProgressDispatcher::instance(), SIGNAL(progressSyncProblem(QString,Progress::SyncProblem)), _accountSettings, SLOT(slotProgressProblem(QString,Progress::SyncProblem)) ); _ui->labelWidget->setCurrentRow(_ui->labelWidget->row(general)); connect(_ui->labelWidget, SIGNAL(currentRowChanged(int)), _ui->stack, SLOT(setCurrentIndex(int))); QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close); connect(closeButton, SIGNAL(pressed()), SLOT(accept())); MirallConfigFile cfg; cfg.restoreGeometry(this); }
Application::Application(int &argc, char **argv) : SharedTools::QtSingleApplication(argc, argv), _tray(0), #if QT_VERSION >= 0x040700 _networkMgr(new QNetworkConfigurationManager(this)), #endif _sslErrorDialog(0), _contextMenu(0), _theme(Theme::instance()), _updateDetector(0), _logBrowser(0), _showLogWindow(false), _logFlush(false), _helpOnly(false), _fileItemDialog(0), _statusDialog(0) { setApplicationName( _theme->appNameGUI() ); setWindowIcon( _theme->applicationIcon() ); parseOptions(arguments()); setupTranslations(); setupLogBrowser(); //no need to waste time; if ( _helpOnly ) return; connect( this, SIGNAL(messageReceived(QString)), SLOT(slotParseOptions(QString))); connect( Logger::instance(), SIGNAL(guiLog(QString,QString)), this, SLOT(slotShowTrayMessage(QString,QString))); // create folder manager for sync folder management _folderMan = new FolderMan(this); connect( _folderMan, SIGNAL(folderSyncStateChange(QString)), this,SLOT(slotSyncStateChange(QString))); _folderMan->setSyncEnabled(false); /* use a signal mapper to map the open requests to the alias names */ _folderOpenActionMapper = new QSignalMapper(this); connect(_folderOpenActionMapper, SIGNAL(mapped(const QString &)), this, SLOT(slotFolderOpenAction(const QString &))); setQuitOnLastWindowClosed(false); _folderWizard = new FolderWizard; _owncloudSetupWizard = new OwncloudSetupWizard( _folderMan, _theme, this ); connect( _owncloudSetupWizard, SIGNAL(ownCloudWizardDone(int)), this, SLOT(slotownCloudWizardDone(int))); _statusDialog = new StatusDialog( _theme ); connect( _statusDialog, SIGNAL(addASync()), this, SLOT(slotAddFolder()) ); connect( _statusDialog, SIGNAL(removeFolderAlias( const QString&)), SLOT(slotRemoveFolder(const QString&))); connect( _statusDialog, SIGNAL(enableFolderAlias(QString,bool)), SLOT(slotEnableFolder(QString,bool))); connect( _statusDialog, SIGNAL(infoFolderAlias(const QString&)), SLOT(slotInfoFolder( const QString&))); connect( _statusDialog, SIGNAL(openFolderAlias(const QString&)), SLOT(slotFolderOpenAction(QString))); #if 0 #if QT_VERSION >= 0x040700 qDebug() << "* Network is" << (_networkMgr->isOnline() ? "online" : "offline"); foreach (const QNetworkConfiguration& netCfg, _networkMgr->allConfigurations(QNetworkConfiguration::Active)) { //qDebug() << "Network:" << netCfg.identifier(); } #endif #endif setupActions(); setupSystemTray(); setupProxy(); int cnt = _folderMan->setupFolders(); _statusDialog->setFolderList( _folderMan->map() ); QObject::connect( this, SIGNAL(messageReceived(QString)), this, SLOT(slotOpenStatus()) ); QTimer::singleShot( 0, this, SLOT( slotStartFolderSetup() )); MirallConfigFile cfg; if( !cfg.ownCloudSkipUpdateCheck() ) { QTimer::singleShot( 3000, this, SLOT( slotStartUpdateDetector() )); } connect( ownCloudInfo::instance(), SIGNAL(sslFailed(QNetworkReply*, QList<QSslError>)), this,SLOT(slotSSLFailed(QNetworkReply*, QList<QSslError>))); qDebug() << "Network Location: " << NetworkLocation::currentLocation().encoded(); }
Application::Application(int &argc, char **argv) : SharedTools::QtSingleApplication(argc, argv), _tray(0), #if QT_VERSION >= 0x040700 _networkMgr(new QNetworkConfigurationManager(this)), #endif _sslErrorDialog(0), _contextMenu(0), _theme(Theme::instance()), _updateDetector(0), _logBrowser(0), _showLogWindow(false), _logFlush(false), _helpOnly(false), _fileItemDialog(0) { setApplicationName( _theme->appNameGUI() ); setWindowIcon( _theme->applicationIcon() ); parseOptions(arguments()); setupTranslations(); setupLogBrowser(); //no need to waste time; if ( _helpOnly ) return; #ifdef Q_OS_LINUX // HACK: bump the refcount for libgnutls by calling dlopen() // so gnutls, which is an dependency of libneon on some linux // distros, and does not cleanup it's FDs properly, does // not get unloaded. This works around a FD exhaustion crash // (#154). We are not using gnutls at all and it's fine // if loading fails, so no error handling is performed here. dlopen("libgnutls.so", RTLD_LAZY|RTLD_NODELETE); #endif connect( this, SIGNAL(messageReceived(QString)), SLOT(slotParseOptions(QString))); connect( Logger::instance(), SIGNAL(guiLog(QString,QString)), this, SLOT(slotShowTrayMessage(QString,QString))); // create folder manager for sync folder management _folderMan = new FolderMan(this); connect( _folderMan, SIGNAL(folderSyncStateChange(QString)), this,SLOT(slotSyncStateChange(QString))); _folderMan->setSyncEnabled(false); /* use a signal mapper to map the open requests to the alias names */ _folderOpenActionMapper = new QSignalMapper(this); connect(_folderOpenActionMapper, SIGNAL(mapped(const QString &)), this, SLOT(slotFolderOpenAction(const QString &))); setQuitOnLastWindowClosed(false); _folderWizard = new FolderWizard; _owncloudSetupWizard = new OwncloudSetupWizard( _folderMan, _theme, this ); connect( _owncloudSetupWizard, SIGNAL(ownCloudWizardDone(int)), this, SLOT(slotownCloudWizardDone(int))); _statusDialog = new StatusDialog( _theme ); connect( _statusDialog, SIGNAL(addASync()), this, SLOT(slotAddFolder()) ); connect( _statusDialog, SIGNAL(removeFolderAlias( const QString&)), SLOT(slotRemoveFolder(const QString&))); connect( _statusDialog, SIGNAL(enableFolderAlias(QString,bool)), SLOT(slotEnableFolder(QString,bool))); connect( _statusDialog, SIGNAL(infoFolderAlias(const QString&)), SLOT(slotInfoFolder( const QString&))); connect( _statusDialog, SIGNAL(openFolderAlias(const QString&)), SLOT(slotFolderOpenAction(QString))); #if 0 #if QT_VERSION >= 0x040700 qDebug() << "* Network is" << (_networkMgr->isOnline() ? "online" : "offline"); foreach (const QNetworkConfiguration& netCfg, _networkMgr->allConfigurations(QNetworkConfiguration::Active)) { //qDebug() << "Network:" << netCfg.identifier(); } #endif #endif setupActions(); setupSystemTray(); setupProxy(); int cnt = _folderMan->setupFolders(); _statusDialog->setFolderList( _folderMan->map() ); QObject::connect( this, SIGNAL(messageReceived(QString)), this, SLOT(slotOpenStatus()) ); QTimer::singleShot( 0, this, SLOT( slotStartFolderSetup() )); MirallConfigFile cfg; if( !cfg.ownCloudSkipUpdateCheck() ) { QTimer::singleShot( 3000, this, SLOT( slotStartUpdateDetector() )); } connect( ownCloudInfo::instance(), SIGNAL(sslFailed(QNetworkReply*, QList<QSslError>)), this,SLOT(slotSSLFailed(QNetworkReply*, QList<QSslError>))); qDebug() << "Network Location: " << NetworkLocation::currentLocation().encoded(); }
Application::Application(int &argc, char **argv) : SharedTools::QtSingleApplication(argc, argv), _tray(0), _sslErrorDialog(0), #if QT_VERSION >= 0x040700 _networkMgr(new QNetworkConfigurationManager(this)), #endif _contextMenu(0), _theme(Theme::instance()), _updateDetector(0), _showLogWindow(false), _logFlush(false), _helpOnly(false), _logBrowser(0) { setApplicationName( _theme->appName() ); setWindowIcon( _theme->applicationIcon() ); parseOptions(arguments()); setupLogBrowser(); //no need to waste time; if ( _helpOnly ) return; processEvents(); QTranslator *qtTranslator = new QTranslator(this); qtTranslator->load(QLatin1String("qt_") + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); installTranslator(qtTranslator); QTranslator *mirallTranslator = new QTranslator(this); #ifdef Q_OS_LINUX // FIXME - proper path! mirallTranslator->load(QLatin1String("mirall_") + QLocale::system().name(), QLatin1String("/usr/share/mirall/i18n/")); #endif #ifdef Q_OS_MAC mirallTranslator->load(QLatin1String("mirall_") + QLocale::system().name(), applicationDirPath()+QLatin1String("/../translations") ); // path defaults to app dir. #endif #ifdef Q_OS_WIN32 mirallTranslator->load(QLatin1String("mirall_") + QLocale::system().name(), applicationDirPath()); #endif installTranslator(mirallTranslator); connect( this, SIGNAL(messageReceived(QString)), SLOT(slotParseOptions(QString))); // create folder manager for sync folder management _folderMan = new FolderMan(this); connect( _folderMan, SIGNAL(folderSyncStateChange(QString)), this,SLOT(slotSyncStateChange(QString))); /* use a signal mapper to map the open requests to the alias names */ _folderOpenActionMapper = new QSignalMapper(this); connect(_folderOpenActionMapper, SIGNAL(mapped(const QString &)), this, SLOT(slotFolderOpenAction(const QString &))); setQuitOnLastWindowClosed(false); _folderWizard = new FolderWizard; _owncloudSetupWizard = new OwncloudSetupWizard( _folderMan, _theme, this ); connect( _owncloudSetupWizard, SIGNAL(ownCloudWizardDone(int)), SLOT(slotStartFolderSetup(int))); _statusDialog = new StatusDialog( _theme ); connect( _statusDialog, SIGNAL(addASync()), this, SLOT(slotAddFolder()) ); connect( _statusDialog, SIGNAL(removeFolderAlias( const QString&)), SLOT(slotRemoveFolder(const QString&))); connect( _statusDialog, SIGNAL(openLogBrowser()), this, SLOT(slotOpenLogBrowser())); connect( _statusDialog, SIGNAL(enableFolderAlias(QString,bool)), SLOT(slotEnableFolder(QString,bool))); connect( _statusDialog, SIGNAL(infoFolderAlias(const QString&)), SLOT(slotInfoFolder( const QString&))); connect( _statusDialog, SIGNAL(openFolderAlias(const QString&)), SLOT(slotFolderOpenAction(QString))); #if QT_VERSION >= 0x040700 qDebug() << "* Network is" << (_networkMgr->isOnline() ? "online" : "offline"); foreach (const QNetworkConfiguration& netCfg, _networkMgr->allConfigurations(QNetworkConfiguration::Active)) { //qDebug() << "Network:" << netCfg.identifier(); } #endif setupActions(); setupSystemTray(); setupProxy(); processEvents(); QObject::connect( this, SIGNAL(messageReceived(QString)), this, SLOT(slotOpenStatus()) ); QTimer::singleShot( 0, this, SLOT( slotStartFolderSetup() )); MirallConfigFile cfg; if( !cfg.ownCloudSkipUpdateCheck() ) { QTimer::singleShot( 3000, this, SLOT( slotStartUpdateDetector() )); } connect( ownCloudInfo::instance(), SIGNAL(sslFailed(QNetworkReply*, QList<QSslError>)), this,SLOT(slotSSLFailed(QNetworkReply*, QList<QSslError>))); qDebug() << "Network Location: " << NetworkLocation::currentLocation().encoded(); }