Mercurial > trustbridge
changeset 483:a055847decbc
merged.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 24 Apr 2014 12:45:11 +0200 |
parents | 0f4331ed4e83 (diff) 214bf504c54f (current diff) |
children | 5c530b2eb0eb 5834b340c54c |
files | |
diffstat | 3 files changed, 53 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/ui/main.cpp Thu Apr 24 10:39:09 2014 +0000 +++ b/ui/main.cpp Thu Apr 24 12:45:11 2014 +0200 @@ -37,9 +37,25 @@ { QApplication app (argc, argv); + QApplication::setQuitOnLastWindowClosed(false); + QApplication::setOrganizationName(QString::fromLatin1(ORGANIZATION)); + QApplication::setApplicationName(QString::fromLatin1(APPNAME)); + QApplication::setApplicationVersion(QString::fromLatin1(VERSION)); + QSettings::setDefaultFormat(QSettings::IniFormat); + QStringList arguments = QApplication::arguments(); bool trayMode = arguments.contains("--tray"); + QSettings settings; + settings.beginGroup("settings"); + int autoStart = settings.value("autostart").toInt(); + settings.endGroup(); + qDebug() << "autostart: " << autoStart; + + if (trayMode && autoStart <= 0) { + return 0; + } + QTranslator translator; if (QLocale::system().name() == "C") { /* Useful for testing / development as the primary target is german */ @@ -60,12 +76,6 @@ return 1; } - QApplication::setQuitOnLastWindowClosed(false); - QApplication::setOrganizationName(QString::fromLatin1(ORGANIZATION)); - QApplication::setApplicationName(QString::fromLatin1(APPNAME)); - QApplication::setApplicationVersion(QString::fromLatin1(VERSION)); - QSettings::setDefaultFormat(QSettings::IniFormat); - MainWindow mainWin(trayMode); return app.exec();
--- a/ui/mainwindow.cpp Thu Apr 24 10:39:09 2014 +0000 +++ b/ui/mainwindow.cpp Thu Apr 24 12:45:11 2014 +0200 @@ -347,7 +347,17 @@ settingsLayout->addWidget(mAutoUpdateOption); settingsLayout->addWidget(mAutoStartOption); settingsBox->setLayout(settingsLayout); -// connect(autoUpdateOption, SIGNAL(stateChanged()), this, SLOT(setAutoUpdate())); + connect(mAutoUpdateOption, SIGNAL(stateChanged(int)), + this, SLOT(saveAutoUpdate(int))); + connect(mAutoStartOption, SIGNAL(stateChanged(int)), + this, SLOT(saveAutoStart(int))); + mSettings.beginGroup("settings"); + int autoUpdate = mSettings.value("autoupdate").toInt(); + int autoStart = mSettings.value("autostart").toInt(); + mSettings.endGroup(); + mAutoUpdateOption->setCheckState(autoUpdate > 0 ? Qt::Checked : Qt::Unchecked); + mAutoStartOption->setCheckState(autoStart > 0 ? Qt::Checked : Qt::Unchecked); + // The buttons. bottomLayout->setAlignment(Qt::AlignBottom); @@ -597,7 +607,10 @@ mSettings.setValue("List/installed", listFileName); mSettings.setValue("List/installedDate", listFileDate); + mInstalledList = mListToInstall; + mListToInstall = CertificateList(); } + loadCertificateList(); } void MainWindow::installCerts() { @@ -657,14 +670,18 @@ bool MainWindow::saveUnselectedCertificates() { + mPreviouslyUnselected.clear(); mSettings.beginGroup("unselected"); mSettings.remove(""); /* Clears old choices */ for (int i = 0; i < mCertListWidget->count(); i++) { QListWidgetItem *item = mCertListWidget->item(i); if (item->checkState() != Qt::Checked && (item->flags() & Qt::ItemIsUserCheckable)) { - mSettings.setValue(QString::fromLatin1("cert%1").arg(i), - item->data(CertificateItemDelegate::DataRole).value<Certificate>().base64Line()); + QString key = QString::fromLatin1("cert%1").arg(i); + QString value = + item->data(CertificateItemDelegate::DataRole).value<Certificate>().base64Line(); + mSettings.setValue(key, value); + mPreviouslyUnselected << value; } } mSettings.endGroup(); @@ -672,6 +689,20 @@ return mSettings.status() == QSettings::NoError; } +void MainWindow::saveAutoUpdate(int state) +{ + mSettings.beginGroup("settings"); + mSettings.setValue("autoupdate", state); + mSettings.endGroup(); +} + +void MainWindow::saveAutoStart(int state) +{ + mSettings.beginGroup("settings"); + mSettings.setValue("autostart", state); + mSettings.endGroup(); +} + void MainWindow::closeApp() { saveUnselectedCertificates();
--- a/ui/mainwindow.h Thu Apr 24 10:39:09 2014 +0000 +++ b/ui/mainwindow.h Thu Apr 24 12:45:11 2014 +0200 @@ -80,6 +80,9 @@ void installCerts(); void newSWAvailable(const QString& fileName, const QDateTime& modDate); + void saveAutoUpdate(int state); + void saveAutoStart(int state); + /** @brief saves the currently unselected certificates * * This creates / updates a qsettings section that