aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt30
-rw-r--r--src/MainWindow.cpp89
-rw-r--r--src/main.cpp15
-rw-r--r--src/ui/AboutDialog.cpp29
-rwxr-xr-xsrc/ui/SettingsDialog.cpp44
-rw-r--r--src/ui/Wizard.cpp16
6 files changed, 133 insertions, 90 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 41c1b026..d5818226 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -3,16 +3,36 @@ add_subdirectory(ui)
aux_source_directory(. BASE_SOURCE)
-file(GLOB_RECURSE GPG4USB_HEADER_FILES RELACTIVE ../include/* *.h)
-qt5_wrap_cpp(QT5_MOCS ${GPG4USB_HEADER_FILES} TARGET gpgfrontend)
+set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_SOURCE_DIR}/gpgfrontend.rc")
+set_property(SOURCE gpgfrontend.rc APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_SOURCE_DIR}/gpgfrontend.ico)
+
+
+file(GLOB_RECURSE GPGFRONTEND_HEADER_FILES RELACTIVE ${CMAKE_SOURCE_DIR}/include/*.h)
+qt5_wrap_cpp(QT5_MOCS ${GPGFRONTEND_HEADER_FILES} TARGET gpgfrontend)
+
+# Set Translation Files
+file(GLOB_RECURSE QT_TS_FILES RELACTIVE ${CMAKE_SOURCE_DIR}/resource/ts/*.ts)
+set(QT_QM_FILES_OUTPUT_DIR ${CMAKE_BINARY_DIR}/src/ts)
+set_source_files_properties(${QT_TS_FILES} PROPERTIES OUTPUT_LOCATION ${QT_QM_FILES_OUTPUT_DIR})
+QT5_create_translation(QON_QM_FILES ${BASE_SOURCE} ${QT_TS_FILES})
+message(STATUS ${QON_QM_FILES})
+add_custom_target(translations DEPENDS ${QON_QM_FILES})
+
# Set Build Information
configure_file(${CMAKE_SOURCE_DIR}/include/GpgFrontend.h.in ${CMAKE_SOURCE_DIR}/include/GpgFrontend.h @ONLY)
-# Copy Resource File
-file(COPY ${CMAKE_SOURCE_DIR}/resource/ DESTINATION ${EXECUTABLE_OUTPUT_PATH}/ FOLLOW_SYMLINK_CHAIN)
+# Copy Resource Files
+file(COPY ${CMAKE_SOURCE_DIR}/resource/css DESTINATION ${EXECUTABLE_OUTPUT_PATH}/ FOLLOW_SYMLINK_CHAIN)
+file(COPY ${CMAKE_SOURCE_DIR}/resource/icons DESTINATION ${EXECUTABLE_OUTPUT_PATH}/ FOLLOW_SYMLINK_CHAIN)
+file(COPY ${CMAKE_SOURCE_DIR}/resource/help DESTINATION ${EXECUTABLE_OUTPUT_PATH}/ FOLLOW_SYMLINK_CHAIN)
+file(COPY ${CMAKE_SOURCE_DIR}/resource/conf DESTINATION ${EXECUTABLE_OUTPUT_PATH}/ FOLLOW_SYMLINK_CHAIN)
+
+set(RESOURCE_FILES ${CMAKE_SOURCE_DIR}/gpgfrontend.qrc ${APP_ICON_RESOURCE_WINDOWS} ${QON_QM_FILES})
+add_custom_target(resources ALL DEPENDS ${RESOURCE_FILES})
+add_dependencies(resources translations)
-add_executable(gpgfrontend ${BASE_SOURCE} ${CMAKE_SOURCE_DIR}/gpgfrontend.qrc ${QT5_MOCS})
+add_executable(gpgfrontend ${BASE_SOURCE} ${RESOURCE_FILES} ${QT5_MOCS})
IF (MINGW)
message(STATUS "Link Application Static Library For MINGW")
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index 665ee2ca..caec9f30 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -24,7 +24,10 @@
#include "MainWindow.h"
-MainWindow::MainWindow() {
+MainWindow::MainWindow()
+ : appPath(qApp->applicationDirPath()),
+ settings(appPath + "/conf/gpgfrontend.ini", QSettings::IniFormat) {
+
mCtx = new GpgME::GpgContext();
/* get path were app was started */
@@ -92,8 +95,9 @@ MainWindow::MainWindow() {
// Show wizard, if the don't show wizard message box wasn't checked
// and keylist doesn't contain a private key
- QSettings qSettings;
- if (qSettings.value("wizard/showWizard", true).toBool() || !qSettings.value("wizard/nextPage").isNull()) {
+ qDebug() << "wizard/showWizard" << settings.value("wizard/showWizard", true).toBool() ;
+ qDebug() << "wizard/nextPage" << settings.value("wizard/nextPage").isNull() ;
+ if (settings.value("wizard/showWizard", true).toBool() || !settings.value("wizard/nextPage").isNull()) {
slotStartWizard();
}
}
@@ -121,15 +125,15 @@ void MainWindow::restoreSettings() {
fileEncButton->setIconSize(iconSize);
// set list of keyserver if not defined
QStringList *keyServerDefaultList;
- keyServerDefaultList = new QStringList("http://pgp.mit.edu");
+ keyServerDefaultList = new QStringList("http://keys.gnupg.net");
+ keyServerDefaultList->append("https://keyserver.ubuntu.com");
keyServerDefaultList->append("http://pool.sks-keyservers.net");
- keyServerDefaultList->append("http://subkeys.pgp.net");
QStringList keyServerList = settings.value("keyserver/keyServerList", *keyServerDefaultList).toStringList();
settings.setValue("keyserver/keyServerList", keyServerList);
// set default keyserver, if it's not set
- QString defaultKeyServer = settings.value("keyserver/defaultKeyServer", QString("http://pgp.mit.edu")).toString();
+ QString defaultKeyServer = settings.value("keyserver/defaultKeyServer", QString("http://keys.gnupg.net")).toString();
settings.setValue("keyserver/defaultKeyServer", defaultKeyServer);
// Iconstyle
@@ -499,7 +503,7 @@ void MainWindow::createMenus() {
cryptMenu->addMenu(fileEncMenu);
keyMenu = menuBar()->addMenu(tr("&Keys"));
- importKeyMenu = keyMenu->addMenu(tr("&Import Key From..."));
+ importKeyMenu = keyMenu->addMenu(tr("&Import Key"));
importKeyMenu->setIcon(QIcon(":key_import.png"));
importKeyMenu->addAction(keyMgmt->importKeyFromFileAct);
importKeyMenu->addAction(importKeyFromEditAct);
@@ -547,7 +551,6 @@ void MainWindow::createToolBars() {
cryptToolBar->addAction(decryptVerifyAct);
cryptToolBar->addAction(signAct);
cryptToolBar->addAction(verifyAct);
- //cryptToolBar->addAction(fileEncryptionAct);
viewMenu->addAction(cryptToolBar->toggleViewAction());
keyToolBar = addToolBar(tr("Key"));
@@ -562,10 +565,11 @@ void MainWindow::createToolBars() {
editToolBar->addAction(selectallAct);
viewMenu->addAction(editToolBar->toggleViewAction());
- specialEditToolBar = addToolBar(tr("Special edit"));
+ specialEditToolBar = addToolBar(tr("Special Edit"));
specialEditToolBar->setObjectName("specialEditToolBar");
specialEditToolBar->addAction(quoteAct);
specialEditToolBar->addAction(cleanDoubleLinebreaksAct);
+ specialEditToolBar->hide();
viewMenu->addAction(specialEditToolBar->toggleViewAction());
// Add dropdown menu for key import to keytoolbar
@@ -584,6 +588,7 @@ void MainWindow::createToolBars() {
fileEncButton->setIcon(QIcon(":fileencryption.png"));
fileEncButton->setToolTip(tr("Encrypt or decrypt File"));
fileEncButton->setText(tr("File.."));
+ fileEncButton->hide();
cryptToolBar->addWidget(fileEncButton);
@@ -990,41 +995,47 @@ void MainWindow::slotOpenSettingsDialog() {
QString preLang = settings.value("int/lang").toString();
QString preKeydbPath = settings.value("gpgpaths/keydbpath").toString();
- new SettingsDialog(mCtx, this);
- // Iconsize
- QSize iconSize = settings.value("toolbar/iconsize", QSize(32, 32)).toSize();
- this->setIconSize(iconSize);
- importButton->setIconSize(iconSize);
- fileEncButton->setIconSize(iconSize);
+ auto dialog = new SettingsDialog(mCtx, this);
- // Iconstyle
- Qt::ToolButtonStyle buttonStyle = static_cast<Qt::ToolButtonStyle>(settings.value("toolbar/iconstyle",
- Qt::ToolButtonTextUnderIcon).toUInt());
- this->setToolButtonStyle(buttonStyle);
- importButton->setToolButtonStyle(buttonStyle);
- fileEncButton->setToolButtonStyle(buttonStyle);
+ connect(dialog, &SettingsDialog::finished, this, [&] () -> void {
- // Mime-settings
- if (settings.value("mime/parseMime").toBool()) {
- createAttachmentDock();
- } else if (attachmentDockCreated) {
- closeAttachmentDock();
- }
+ qDebug() << "Setting Dialog Finished";
+
+ // Iconsize
+ QSize iconSize = settings.value("toolbar/iconsize", QSize(32, 32)).toSize();
+ this->setIconSize(iconSize);
+ importButton->setIconSize(iconSize);
+ fileEncButton->setIconSize(iconSize);
- // restart mainwindow if necessary
- if (getRestartNeeded()) {
- if (edit->maybeSaveAnyTab()) {
- saveSettings();
- qApp->exit(RESTART_CODE);
+ // Iconstyle
+ Qt::ToolButtonStyle buttonStyle = static_cast<Qt::ToolButtonStyle>(settings.value("toolbar/iconstyle",
+ Qt::ToolButtonTextUnderIcon).toUInt());
+ this->setToolButtonStyle(buttonStyle);
+ importButton->setToolButtonStyle(buttonStyle);
+ fileEncButton->setToolButtonStyle(buttonStyle);
+
+ // Mime-settings
+ if (settings.value("mime/parseMime").toBool()) {
+ createAttachmentDock();
+ } else if (attachmentDockCreated) {
+ closeAttachmentDock();
}
- }
- // steganography hide/show
- if (!settings.value("advanced/steganography").toBool()) {
- this->menuBar()->removeAction(steganoMenu->menuAction());
- } else {
- this->menuBar()->insertAction(viewMenu->menuAction(), steganoMenu->menuAction());
- }
+ // restart mainwindow if necessary
+ if (getRestartNeeded()) {
+ if (edit->maybeSaveAnyTab()) {
+ saveSettings();
+ qApp->exit(RESTART_CODE);
+ }
+ }
+
+ // steganography hide/show
+ if (!settings.value("advanced/steganography").toBool()) {
+ this->menuBar()->removeAction(steganoMenu->menuAction());
+ } else {
+ this->menuBar()->insertAction(viewMenu->menuAction(), steganoMenu->menuAction());
+ }
+ });
}
diff --git a/src/main.cpp b/src/main.cpp
index 7ce4a946..b2aca517 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -43,7 +43,7 @@ int main(int argc, char *argv[]) {
QTextCodec::setCodecForLocale(QTextCodec::codecForName("utf-8"));
// css
- QFile file(qApp->applicationDirPath() + "/css/default.css");
+ QFile file(qApp->applicationDirPath() + "/css/default.qss");
file.open(QFile::ReadOnly);
QString styleSheet = QLatin1String(file.readAll());
qApp->setStyleSheet(styleSheet);
@@ -53,11 +53,16 @@ int main(int argc, char *argv[]) {
* internationalisation. loop to restart mainwindow
* with changed translation when settings change.
*/
+ if(!QDir(appPath + "/conf").exists()) {
+ QDir().mkdir(appPath + "/conf");
+ }
QSettings::setDefaultFormat(QSettings::IniFormat);
- QSettings settings;
+ QSettings settings(appPath + "/conf/gpgfrontend.ini", QSettings::IniFormat);
QTranslator translator, translator2;
int return_from_event_loop_code;
+ qDebug() << settings.fileName();
+
do {
QApplication::removeTranslator(&translator);
QApplication::removeTranslator(&translator2);
@@ -66,12 +71,14 @@ int main(int argc, char *argv[]) {
if (lang.isEmpty()) {
lang = QLocale::system().name();
}
-
- translator.load("./ts/gpg4usb_" + lang, appPath);
+ qDebug() << "Language set" << lang;
+ translator.load( appPath + "/ts/" + "gpg4usb_" + lang);
+ qDebug() << "Translator" << translator.filePath();
QApplication::installTranslator(&translator);
// set qt translations
translator2.load("./ts/qt_" + lang, appPath);
+ qDebug() << "Translator2" << translator2.filePath();
QApplication::installTranslator(&translator2);
MainWindow window;
diff --git a/src/ui/AboutDialog.cpp b/src/ui/AboutDialog.cpp
index 67069049..652bb956 100644
--- a/src/ui/AboutDialog.cpp
+++ b/src/ui/AboutDialog.cpp
@@ -49,19 +49,22 @@ AboutDialog::AboutDialog(QWidget *parent)
InfoTab::InfoTab(QWidget *parent)
: QWidget(parent) {
auto *pixmap = new QPixmap(":gpgfrontend-logo.png");
- auto *text = new QString("<center><h2>" + qApp->applicationName() + " "
- + qApp->applicationVersion() + "</h2></center>"
- + tr("<center>This application allows simple encryption <br>"
- "and decryption of text messages or files.<br>"
- "It's licensed under the GPL v3<br><br>"
- "<b>Developer:</b><br>"
- "Saturneric<br><br>"
- "If you have any questions or suggestions have a look<br/>"
- "at my <a href=\"https://bktus.com/%e8%81%94%e7%b3%bb%e4%b8%8e%e9%aa%8c%e8%af%81\">"
- "contact page</a> or send a mail to my<br/> mailing list at"
- " <a href=\"mailto:[email protected]\">[email protected]</a>.") +
- tr("<br><br> Built with Qt ") + qVersion()
- + tr(" and GPGME ") + GpgME::GpgContext::getGpgmeVersion() + "</center>");
+ auto *text = new QString("<center><h2>" + qApp->applicationName() + "</h2></center>"
+ + "<center><b>" + qApp->applicationVersion() + "</b></center>"
+ + "<center>" + GIT_VERSION + "</center>"
+ + tr("<br><center>GPGFrontend is a modern, easy-to-use, compact, <br>"
+ "cross-platform, and installation-free gpg front-end tool.<br>"
+ "It visualizes most of the common operations of gpg commands.<br>"
+ "It's licensed under the GPL v3<br><br>"
+ "<b>Developer:</b><br>"
+ "Saturneric<br><br>"
+ "If you have any questions or suggestions have a look<br/>"
+ "at my <a href=\"https://bktus.com/%e8%81%94%e7%b3%bb%e4%b8%8e%e9%aa%8c%e8%af%81\">"
+ "contact page</a> or send a mail to my<br/> mailing list at"
+ " <a href=\"mailto:[email protected]\">[email protected]</a>.") +
+ tr("<br><br> Built with Qt ") + qVersion()
+ + tr(" and GPGME ") + GpgME::GpgContext::getGpgmeVersion() +
+ tr("<br>Built at ") + BUILD_TIMESTAMP + "</center>");
auto *layout = new QGridLayout();
auto *pixmapLabel = new QLabel();
diff --git a/src/ui/SettingsDialog.cpp b/src/ui/SettingsDialog.cpp
index 99a25f8a..7d9547b2 100755
--- a/src/ui/SettingsDialog.cpp
+++ b/src/ui/SettingsDialog.cpp
@@ -121,7 +121,8 @@ QHash<QString, QString> SettingsDialog::listLanguages() {
GeneralTab::GeneralTab(GpgME::GpgContext *ctx, QWidget *parent)
- : QWidget(parent) {
+ : QWidget(parent), appPath(qApp->applicationDirPath()),
+ settings(appPath + "/conf/gpgfrontend.ini", QSettings::IniFormat) {
mCtx = ctx;
/*****************************************
@@ -225,7 +226,6 @@ GeneralTab::GeneralTab(GpgME::GpgContext *ctx, QWidget *parent)
* appropriately
**********************************/
void GeneralTab::setSettings() {
- QSettings settings;
// Keysaving
if (settings.value("keys/keySave").toBool()) {
saveCheckedKeysCheckBox->setCheckState(Qt::Checked);
@@ -276,7 +276,6 @@ void GeneralTab::setSettings() {
* write them to settings-file
*************************************/
void GeneralTab::applySettings() {
- QSettings settings;
settings.setValue("keys/keySave", saveCheckedKeysCheckBox->isChecked());
// TODO: clear passwordCache instantly on unset rememberPassword
settings.setValue("general/rememberPassword", rememberPasswordCheckBox->isChecked());
@@ -333,7 +332,8 @@ void GeneralTab::slotOwnKeyIdChanged() {
}
MimeTab::MimeTab(QWidget *parent)
- : QWidget(parent) {
+ : QWidget(parent), appPath(qApp->applicationDirPath()),
+ settings(appPath + "/conf/gpgfrontend.ini", QSettings::IniFormat) {
/*****************************************
* MIME-Parsing-Box
*****************************************/
@@ -379,7 +379,6 @@ MimeTab::MimeTab(QWidget *parent)
* appropriately
**********************************/
void MimeTab::setSettings() {
- QSettings settings;
// MIME-Parsing
if (settings.value("mime/parsemime").toBool()) mimeParseCheckBox->setCheckState(Qt::Checked);
@@ -397,7 +396,6 @@ void MimeTab::setSettings() {
* write them to settings-file
*************************************/
void MimeTab::applySettings() {
- QSettings settings;
settings.setValue("mime/parsemime", mimeParseCheckBox->isChecked());
settings.setValue("mime/parseQP", mimeQPCheckBox->isChecked());
settings.setValue("mime/openAttachment", mimeOpenAttachmentCheckBox->isChecked());
@@ -405,7 +403,8 @@ void MimeTab::applySettings() {
}
AppearanceTab::AppearanceTab(QWidget *parent)
- : QWidget(parent) {
+ : QWidget(parent), appPath(qApp->applicationDirPath()),
+ settings(appPath + "/conf/gpgfrontend.ini", QSettings::IniFormat) {
/*****************************************
* Icon-Size-Box
*****************************************/
@@ -470,7 +469,6 @@ AppearanceTab::AppearanceTab(QWidget *parent)
* appropriately
**********************************/
void AppearanceTab::setSettings() {
- QSettings settings;
//Iconsize
QSize iconSize = settings.value("toolbar/iconsize", QSize(24, 24)).toSize();
@@ -512,7 +510,6 @@ void AppearanceTab::setSettings() {
* write them to settings-file
*************************************/
void AppearanceTab::applySettings() {
- QSettings settings;
switch (iconSizeGroup->checkedId()) {
case 1:
settings.setValue("toolbar/iconsize", QSize(12, 12));
@@ -541,7 +538,11 @@ void AppearanceTab::applySettings() {
}
KeyserverTab::KeyserverTab(QWidget *parent)
- : QWidget(parent) {
+ : QWidget(parent), appPath(qApp->applicationDirPath()),
+ settings(appPath + "/conf/gpgfrontend.ini", QSettings::IniFormat) {
+
+ auto keyServerList = settings.value("keyserver/keyServerList").toStringList();
+
auto *mainLayout = new QVBoxLayout(this);
auto *label = new QLabel(tr("Default Keyserver for import:"));
@@ -549,6 +550,13 @@ KeyserverTab::KeyserverTab(QWidget *parent)
comboBox->setEditable(false);
comboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+ for (const auto &keyServer : keyServerList) {
+ comboBox->addItem(keyServer);
+ qDebug() << "KeyserverTab Get ListItemText" << keyServer;
+ }
+
+ comboBox->setCurrentText(settings.value("keyserver/defaultKeyServer").toString());
+
auto *addKeyServerBox = new QWidget(this);
auto *addKeyServerLayout = new QHBoxLayout(addKeyServerBox);
auto *http = new QLabel("URL: ");
@@ -575,14 +583,13 @@ KeyserverTab::KeyserverTab(QWidget *parent)
* appropriately
**********************************/
void KeyserverTab::setSettings() {
- QSettings settings;
- QString defKeyserver = settings.value("keyserver/defaultKeyServer").toString();
-
auto *keyServerList = new QStringList();
for (int i = 0; i < comboBox->count(); i++) {
keyServerList->append(comboBox->itemText(i));
+ qDebug() << "KeyserverTab ListItemText" << comboBox->itemText(i);
}
settings.setValue("keyserver/keyServerList", *keyServerList);
+ settings.setValue("keyserver/defaultKeyServer", comboBox->currentText());
}
void KeyserverTab::addKeyServer() {
@@ -599,12 +606,12 @@ void KeyserverTab::addKeyServer() {
* write them to settings-file
*************************************/
void KeyserverTab::applySettings() {
- QSettings settings;
settings.setValue("keyserver/defaultKeyServer", comboBox->currentText());
}
AdvancedTab::AdvancedTab(QWidget *parent)
- : QWidget(parent) {
+ : QWidget(parent), appPath(qApp->applicationDirPath()),
+ settings(appPath + "/conf/gpgfrontend.ini", QSettings::IniFormat) {
/*****************************************
* Steganography Box
*****************************************/
@@ -623,19 +630,18 @@ AdvancedTab::AdvancedTab(QWidget *parent)
}
void AdvancedTab::setSettings() {
- QSettings settings;
if (settings.value("advanced/steganography").toBool()) {
steganoCheckBox->setCheckState(Qt::Checked);
}
}
void AdvancedTab::applySettings() {
- QSettings settings;
settings.setValue("advanced/steganography", steganoCheckBox->isChecked());
}
GpgPathsTab::GpgPathsTab(QWidget *parent)
- : QWidget(parent) {
+ : QWidget(parent), appPath(qApp->applicationDirPath()),
+ settings(appPath + "/conf/gpgfrontend.ini", QSettings::IniFormat) {
setSettings();
/*****************************************
@@ -696,7 +702,6 @@ QString GpgPathsTab::chooseKeydbDir() {
void GpgPathsTab::setSettings() {
defKeydbPath = qApp->applicationDirPath() + "/keydb";
- QSettings settings;
accKeydbPath = settings.value("gpgpaths/keydbpath").toString();
if (accKeydbPath.isEmpty()) {
accKeydbPath = ".";
@@ -704,6 +709,5 @@ void GpgPathsTab::setSettings() {
}
void GpgPathsTab::applySettings() {
- QSettings settings;
settings.setValue("gpgpaths/keydbpath", accKeydbPath);
}
diff --git a/src/ui/Wizard.cpp b/src/ui/Wizard.cpp
index 03883a06..c685cc92 100644
--- a/src/ui/Wizard.cpp
+++ b/src/ui/Wizard.cpp
@@ -29,7 +29,8 @@
#endif
Wizard::Wizard(GpgME::GpgContext *ctx, KeyMgmt *keyMgmt, QWidget *parent)
- : QWizard(parent) {
+ : QWizard(parent), appPath(qApp->applicationDirPath()),
+ settings(appPath + "/conf/gpgfrontend.ini", QSettings::IniFormat) {
mCtx = ctx;
mKeyMgmt = keyMgmt;
@@ -49,7 +50,6 @@ Wizard::Wizard(GpgME::GpgContext *ctx, KeyMgmt *keyMgmt, QWidget *parent)
setPixmap(QWizard::LogoPixmap, QPixmap(":/logo_small.png"));
setPixmap(QWizard::BannerPixmap, QPixmap(":/banner.png"));
- QSettings settings;
setStartId(settings.value("wizard/nextPage", -1).toInt());
settings.remove("wizard/nextPage");
@@ -59,7 +59,6 @@ Wizard::Wizard(GpgME::GpgContext *ctx, KeyMgmt *keyMgmt, QWidget *parent)
}
void Wizard::slotWizardAccepted() {
- QSettings settings;
// Don't show is mapped to show -> negation
settings.setValue("wizard/showWizard", !field("showWizard").toBool());
@@ -107,7 +106,8 @@ bool Wizard::importPubAndSecKeysFromDir(const QString &dir, KeyMgmt *keyMgmt) {
}
IntroPage::IntroPage(QWidget *parent)
- : QWizardPage(parent) {
+ : QWizardPage(parent), appPath(qApp->applicationDirPath()),
+ settings(appPath + "/conf/gpgfrontend.ini", QSettings::IniFormat) {
setTitle(tr("Getting started..."));
setSubTitle(tr("... with GPGFrontend"));
@@ -130,7 +130,6 @@ IntroPage::IntroPage(QWidget *parent)
langSelectBox->addItem(l);
}
// selected entry from config
- QSettings settings;
QString langKey = settings.value("int/lang").toString();
QString langValue = languages.value(langKey);
if (langKey != "") {
@@ -148,7 +147,6 @@ IntroPage::IntroPage(QWidget *parent)
}
void IntroPage::slotLangChange(const QString &lang) {
- QSettings settings;
settings.setValue("int/lang", languages.key(lang));
settings.setValue("wizard/nextPage", this->wizard()->currentId());
qApp->exit(RESTART_CODE);
@@ -203,7 +201,8 @@ void ChoosePage::slotJumpPage(const QString &page) {
}
ImportFromGpg4usbPage::ImportFromGpg4usbPage(GpgME::GpgContext *ctx, KeyMgmt *keyMgmt, QWidget *parent)
- : QWizardPage(parent) {
+ : QWizardPage(parent), appPath(qApp->applicationDirPath()),
+ settings(appPath + "/conf/gpgfrontend.ini", QSettings::IniFormat) {
mCtx = ctx;
mKeyMgmt = keyMgmt;
setTitle(tr("Import from..."));
@@ -255,7 +254,6 @@ void ImportFromGpg4usbPage::slotImportFromOlderGpg4usb() {
if (gpg4usbConfigCheckBox->isChecked()) {
slotImportConfFromGpg4usb(dir);
- QSettings settings;
settings.setValue("wizard/nextPage", this->nextId());
QMessageBox::information(nullptr, tr("Configuration Imported"),
tr("Imported Configuration from old GPGFrontend.<br>"
@@ -267,7 +265,7 @@ void ImportFromGpg4usbPage::slotImportFromOlderGpg4usb() {
}
bool ImportFromGpg4usbPage::slotImportConfFromGpg4usb(const QString &dir) {
- QString path = dir + "/conf/GPGFrontend.ini";
+ QString path = dir + "/conf/gpgfrontend.ini";
QSettings oldconf(path, QSettings::IniFormat, this);
QSettings actualConf;
foreach(QString key, oldconf.allKeys()) {