diff options
author | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2010-03-28 10:58:46 +0000 |
---|---|---|
committer | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2010-03-28 10:58:46 +0000 |
commit | bdc7315b2e1aeac0efa3864e9f06256cf6559d68 (patch) | |
tree | 395b507de45b666cd2188a6110e0f557558b73b2 | |
parent | added settings dialog (test version) (diff) | |
download | gpg4usb-bdc7315b2e1aeac0efa3864e9f06256cf6559d68.tar.gz gpg4usb-bdc7315b2e1aeac0efa3864e9f06256cf6559d68.zip |
added settingsdialog files
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@285 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r-- | gpgwin.cpp | 2 | ||||
-rw-r--r-- | keydetailsdialog.cpp | 2 | ||||
-rw-r--r-- | keylist.cpp | 2 | ||||
-rwxr-xr-x | settingsdialog.cpp | 100 | ||||
-rwxr-xr-x | settingsdialog.h | 42 |
5 files changed, 145 insertions, 3 deletions
@@ -359,7 +359,7 @@ void GpgWin::setCurrentFile(const QString &fileName) QString shownName; if (curFile.isEmpty()) - shownName = tr("untitled.txt"); + shownName = "untitled.txt"; else shownName = strippedName(curFile); diff --git a/keydetailsdialog.cpp b/keydetailsdialog.cpp index 4511cba..0712143 100644 --- a/keydetailsdialog.cpp +++ b/keydetailsdialog.cpp @@ -144,7 +144,7 @@ void KeyDetailsDialog::exportPrivateKey() { QByteArray *keyArray = new QByteArray(); mCtx->exportSecretKey(*keyid, keyArray); - QString fileName = QFileDialog::getSaveFileName(this, tr("Export Key To File"), "", tr("Key Files") + " (*.asc *.txt);;All Files (*)"); + QString fileName = QFileDialog::getSaveFileName(this, tr("Export Key To File"), "", tr("Key Files ") + " (*.asc *.txt);;All Files (*)"); QFile file(fileName); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) return; diff --git a/keylist.cpp b/keylist.cpp index b45f7eb..be9aa7a 100644 --- a/keylist.cpp +++ b/keylist.cpp @@ -45,7 +45,7 @@ KeyList::KeyList(GpgME::Context *ctx, QString iconpath, QWidget *parent) mKeyList->setAlternatingRowColors(true); QStringList labels; - labels << "" << "" << tr("Name") << tr("EMail") << tr("id"); + labels << "" << "" << tr("Name") << tr("EMail") << "id"; mKeyList->setHorizontalHeaderLabels(labels); mKeyList->horizontalHeader()->setStretchLastSection(true); diff --git a/settingsdialog.cpp b/settingsdialog.cpp new file mode 100755 index 0000000..a435904 --- /dev/null +++ b/settingsdialog.cpp @@ -0,0 +1,100 @@ +/* + * settingsdialog.cpp + * + * Copyright 2008 gpg4usb-team <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +#include <QWidget> + +#include <QHBoxLayout> +#include <QVBoxLayout> +#include <QDebug> +#include <QLabel> +#include <QGridLayout> +#include <QGroupBox> +#include <QDialogButtonBox> +#include <QRadioButton> +#include <QButtonGroup> +#include <QSettings> +#include "settingsdialog.h" + +SettingsDialog::SettingsDialog() +{ + setWindowTitle(tr("Settings")); + resize(500, 200); + setModal(true); + + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + connect(buttonBox, SIGNAL(accepted()), this, SLOT(applySettings())); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + + groupBox1 = new QGroupBox(tr("Options")); + groupBox2 = new QGroupBox("Action"); + + QRadioButton *iconTextButton = new QRadioButton(tr("just test")); + QRadioButton *iconIconsButton =new QRadioButton(tr("just icons")); + QRadioButton *iconAllButton = new QRadioButton(tr("text and icons")); + + QHBoxLayout *iconStyleBox = new QHBoxLayout(); + iconStyleBox->addWidget(iconTextButton); + iconStyleBox->addWidget(iconIconsButton); + iconStyleBox->addWidget(iconAllButton); + group1 = new QButtonGroup(); + + QRadioButton *iconSizeSmall = new QRadioButton(tr("small")); + QRadioButton *iconSizeMedium =new QRadioButton(tr("medium")); + QRadioButton *iconSizeLarge = new QRadioButton(tr("large")); + group1->addButton(iconSizeSmall,1); + group1->addButton(iconSizeMedium,2); + group1->addButton(iconSizeLarge,3); + + + QHBoxLayout *iconSizeBox = new QHBoxLayout(); + iconSizeBox->addWidget(iconSizeSmall); + iconSizeBox->addWidget(iconSizeMedium); + iconSizeBox->addWidget(iconSizeLarge); + + groupBox1->setLayout(iconStyleBox); + groupBox2->setLayout(iconSizeBox); + + + QVBoxLayout *vbox2 = new QVBoxLayout(); + vbox2->addWidget(groupBox1); + vbox2->addWidget(groupBox2); + vbox2->addWidget(buttonBox); + setLayout(vbox2); + exec(); +} + +void SettingsDialog::applySettings() +{ + QSettings settings; + //settings.setValue("geometry", saveGeometry()); + + qDebug() << group1->checkedId(); + switch (group1->checkedId()){ + case 1: + settings.setValue("toolbar/iconsize", QSize(12, 12)); + break; + + case 2:settings.setValue("toolbar/iconsize", QSize(24, 24)); + break; + case 3:settings.setValue("toolbar/iconsize", QSize(32, 32)); + break; + } +} diff --git a/settingsdialog.h b/settingsdialog.h new file mode 100755 index 0000000..085e161 --- /dev/null +++ b/settingsdialog.h @@ -0,0 +1,42 @@ +/* + * settingsdialog.h + * + * Copyright 2008 gpg4usb-team <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +#include <QDialog> +#include <QButtonGroup> +#include <QGroupBox> + +class SettingsDialog : public QDialog +{ + Q_OBJECT + +public: + SettingsDialog(); + +public slots: + void applySettings(); + + + +private: + QGroupBox *groupBox1; + QGroupBox *groupBox2; + QButtonGroup *group1; +}; |