summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnne Jan Brouwer <brouwer@annejan.com>2015-05-18 09:46:23 +0200
committerAnne Jan Brouwer <annejan@noprotocol.com>2015-05-18 09:46:23 +0200
commitca47394ea972e7cfc139fff2d98d9710065735c6 (patch)
treed062039d6a75be1d56d903c077b9156a70596457
parenteeff9789f213d71eeccd00f908c3ab777729170c (diff)
Revert "Basic profile framework"
-rw-r--r--README.md1
-rw-r--r--dialog.cpp26
-rw-r--r--dialog.h2
-rw-r--r--dialog.ui232
-rw-r--r--mainwindow.cpp60
-rw-r--r--mainwindow.h4
6 files changed, 95 insertions, 230 deletions
diff --git a/README.md b/README.md
index 9aefd4e8..9b64b8e6 100644
--- a/README.md
+++ b/README.md
@@ -57,7 +57,6 @@ Planned features
* Templates (username, url etc) in Add / Edit screen (configurable templates)
* Colour coding or disabling of people you can't encrypt for (trust settings) in User management
* Colour coding folders (possibly disabling folders you can't decrypt)
-* Trayicon support
* WebDAV (configuration) support
* Optional table view of decrypted folder contents
* Opening of (basic auth) urls in default browser? Possibly with helper plugin for filling out forms?
diff --git a/dialog.cpp b/dialog.cpp
index c10a4d81..20068f79 100644
--- a/dialog.cpp
+++ b/dialog.cpp
@@ -348,29 +348,3 @@ void Dialog::addGPGId(bool addGPGId)
{
ui->checkBoxAddGPGId->setChecked(addGPGId);
}
-
-/**
- * @brief Dialog::setProfiles
- * @param profiles
- */
-void Dialog::setProfiles(QHash<QString, QString> profiles)
-{
- QHashIterator<QString, QString> i(profiles);
- while (i.hasNext()) {
- i.next();
- // TODO
- ui->profileName->setText(i.key());
- ui->storePath->setText(i.value());
- }
-}
-
-/**
- * @brief Dialog::getProfiles
- * @return
- */
-QHash<QString, QString> Dialog::getProfiles()
-{
- QHash<QString, QString> profiles;
- profiles.insert(ui->profileName->text(), ui->storePath->text());
- return profiles;
-}
diff --git a/dialog.h b/dialog.h
index fe75259e..1617bb75 100644
--- a/dialog.h
+++ b/dialog.h
@@ -19,7 +19,6 @@ public:
void setGitPath(QString);
void setGpgPath(QString);
void setStorePath(QString);
- void setProfiles(QHash<QString, QString>);
void usePass(bool);
void useClipboard(bool);
void useAutoclear(bool);
@@ -31,7 +30,6 @@ public:
QString getGitPath();
QString getGpgPath();
QString getStorePath();
- QHash<QString,QString> getProfiles();
bool usePass();
bool useClipboard();
bool useAutoclear();
diff --git a/dialog.ui b/dialog.ui
index 4cf57c49..017f3ac9 100644
--- a/dialog.ui
+++ b/dialog.ui
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>660</width>
+ <width>507</width>
<height>446</height>
</rect>
</property>
@@ -15,176 +15,120 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QFrame" name="frame">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Plain</enum>
- </property>
- <property name="lineWidth">
- <number>0</number>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_5">
- <item>
- <widget class="QRadioButton" name="radioButtonNative">
- <property name="text">
- <string>&amp;Native git/gpg</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="radioButtonPass">
- <property name="text">
- <string>&amp;Use pass</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
- <widget class="QGroupBox" name="groupBoxNative">
- <property name="title">
- <string>Native</string>
+ <widget class="QRadioButton" name="radioButtonNative">
+ <property name="text">
+ <string>&amp;Native git/gpg</string>
</property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="labelGitPath">
- <property name="text">
- <string>Executable git</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="gpgPath"/>
- </item>
- <item row="0" column="2">
- <widget class="QToolButton" name="toolButtonGit">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="labelGpgPath">
- <property name="text">
- <string>Executable gpg</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QToolButton" name="toolButtonGpg">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="gitPath"/>
- </item>
- </layout>
</widget>
</item>
<item>
- <widget class="QGroupBox" name="groupBoxPass">
- <property name="title">
- <string>Pass</string>
+ <widget class="QRadioButton" name="radioButtonPass">
+ <property name="text">
+ <string>&amp;Use pass</string>
</property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="2">
- <widget class="QToolButton" name="toolButtonPass">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="labelPassPath">
- <property name="text">
- <string>Executable pass</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="passPath"/>
- </item>
- </layout>
</widget>
</item>
</layout>
</item>
<item>
- <widget class="QGroupBox" name="groupBoxProfiles">
+ <widget class="QGroupBox" name="groupBoxNative">
+ <property name="title">
+ <string>Native</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="gpgPath"/>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="gitPath"/>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="labelGitPath">
+ <property name="text">
+ <string>Executable git</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="labelGpgPath">
+ <property name="text">
+ <string>Executable gpg</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QToolButton" name="toolButtonGpg">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QToolButton" name="toolButtonGit">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBoxPass">
+ <property name="title">
+ <string>Pass</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="2">
+ <widget class="QToolButton" name="toolButtonPass">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="labelPassPath">
+ <property name="text">
+ <string>Executable pass</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="passPath"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
<property name="title">
- <string>Profiles</string>
+ <string>Other</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
+ <layout class="QGridLayout" name="gridLayout_6">
+ <item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_5">
- <item row="1" column="3">
- <widget class="QLineEdit" name="storePath"/>
- </item>
- <item row="1" column="4">
- <widget class="QToolButton" name="toolButtonStore">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
+ <item row="0" column="0">
<widget class="QLabel" name="labelStorePath">
<property name="text">
<string>Folder password-store</string>
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="profileName"/>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="storePath"/>
</item>
- <item row="1" column="0">
- <widget class="QLabel" name="labelName">
+ <item row="0" column="2">
+ <widget class="QToolButton" name="toolButtonStore">
<property name="text">
- <string>Profile name</string>
+ <string>...</string>
</property>
</widget>
</item>
</layout>
</item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBoxOther">
- <property name="title">
- <string>Other</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_6">
- <item row="0" column="0">
+ <item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QCheckBox" name="checkBoxClipboard">
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 0d5aefd7..4f5421c9 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -164,13 +164,7 @@ void MainWindow::checkConfig() {
webDavUrl = settings.value("webDavUrl").toString();
webDavUser = settings.value("webDavUser").toString();
webDavPassword = settings.value("webDavPassword").toString();
-
- settings.beginGroup("profiles");
- QStringList keys = settings.childKeys();
- foreach (QString key, keys) {
- profiles[key] = settings.value(key).toString();
- }
- settings.endGroup();
+ profiles = settings.value("profiles").toStringList();
if (passExecutable == "" && (gitExecutable == "" || gpgExecutable == "")) {
config();
@@ -202,8 +196,11 @@ void MainWindow::checkConfig() {
ui->treeView->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
ui->textBrowser->setOpenExternalLinks(true);
-
- updateProfileBox();
+ if (profiles.isEmpty()) {
+ ui->profileBox->setEnabled(false);
+ } else {
+ ui->profileBox->addItems(profiles);
+ }
env = QProcess::systemEnvironment();
if (!gpgHome.isEmpty()) {
@@ -244,7 +241,6 @@ void MainWindow::config() {
d->hidePassword(hidePassword);
d->hideContent(hideContent);
d->addGPGId(addGPGId);
- d->setProfiles(profiles);
if (d->exec()) {
if (d->result() == QDialog::Accepted) {
@@ -260,7 +256,6 @@ void MainWindow::config() {
hidePassword = d->hidePassword();
hideContent = d->hideContent();
addGPGId = d->addGPGId();
- profiles = d->getProfiles();
QSettings &settings(getSettings());
@@ -275,25 +270,7 @@ void MainWindow::config() {
settings.setValue("hidePassword", hidePassword ? "true" : "false");
settings.setValue("hideContent", hideContent ? "true" : "false");
settings.setValue("addGPGId", addGPGId ? "true" : "false");
- settings.beginGroup("profiles");
- settings.remove("");
- bool profileExists = false;
- QHashIterator<QString, QString> i(profiles);
- while (i.hasNext()) {
- i.next();
- //qDebug() << i.key() + "|" + i.value();
- if (i.key() == profile) {
- profileExists = true;
- }
- settings.setValue(i.key(), i.value());
- }
- if (!profileExists) {
- // just take the last one
- profile = i.key();
- }
- settings.endGroup();
- updateProfileBox();
ui->treeView->setRootIndex(model.setRootPath(passStore));
}
}
@@ -922,28 +899,3 @@ void MainWindow::setText(QString text)
{
ui->lineEdit->setText(text);
}
-
-/**
- * @brief MainWindow::updateProfileBox
- */
-void MainWindow::updateProfileBox()
-{
- if (profiles.isEmpty()) {
- ui->profileBox->setVisible(false);
- } else {
- ui->profileBox->setVisible(true);
- if (profiles.size() < 2) {
- ui->profileBox->setEnabled(false);
- }
- ui->profileBox->clear();
- QHashIterator<QString, QString> i(profiles);
- while (i.hasNext()) {
- i.next();
- ui->profileBox->addItem(i.key());
- }
- }
- int index = ui->profileBox->findData(profile);
- if ( index != -1 ) { // -1 for not found
- ui->profileBox->setCurrentIndex(index);
- }
-}
diff --git a/mainwindow.h b/mainwindow.h
index fd61dc6d..fd535115 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -89,9 +89,8 @@ private:
QString lastDecrypt;
bool wrapperRunning;
QStringList env;
- QHash<QString, QString> profiles;
+ QStringList profiles;
QQueue<execQueueItem> *execQueue;
- QString profile;
void updateText();
void executePass(QString, QString = QString());
void executeWrapper(QString, QString, QString = QString());
@@ -108,7 +107,6 @@ private:
QStringList getRecipientList(QString for_file);
QString getRecipientString(QString for_file, QString separator = " ", int *count = NULL);
void mountWebDav();
- void updateProfileBox();
};
#endif // MAINWINDOW_H