#
#
# patch "res/forms/dialogs/generate_keypair.ui"
# from [e610eb7e431daa5ce1e8dc247fa22abc5da1d302]
# to [e9703bc3ad6b0e2bc8af405d647e06bb57996535]
#
# patch "src/model/Keys.cpp"
# from [02497764e76e5dca25c68abdc2a106b84c28a86b]
# to [bac22fe33fe8e16f4ab76201d6f9b3cb527942de]
#
# patch "src/model/Keys.h"
# from [3131df73288c46a0f22f82d5490e5a184666d9a1]
# to [9f6df7cf905951771dbb4f1cc1a49117a43c2e34]
#
# patch "src/view/dialogs/GenerateKeypair.cpp"
# from [ed77400baeffdea21382a03f2dd29d33dd33085c]
# to [a5ecff9abb5c83a965e3c782c424004819a6f708]
#
# patch "src/view/dialogs/KeyManagement.cpp"
# from [4bbfdd2899ac31e85629ccf5e0f48d4810e2e08f]
# to [c282dc5376939e8814d89faeb099d5b677e2d07b]
#
============================================================
--- res/forms/dialogs/generate_keypair.ui e610eb7e431daa5ce1e8dc247fa22abc5da1d302
+++ res/forms/dialogs/generate_keypair.ui e9703bc3ad6b0e2bc8af405d647e06bb57996535
@@ -13,7 +13,7 @@
0
0
382
- 182
+ 204
@@ -68,7 +68,7 @@
-
- allow duplicate key ID
+ allow duplicate Key ID
@@ -112,7 +112,7 @@
- -
+
-
Qt::Horizontal
@@ -122,6 +122,21 @@
+ -
+
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Set this option if you don't want to set up a lua hook which tells monotone the passphrase for key decryption.</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">WARNING:</span> Passwords are stored unencrypted in guitone's settings!</p></body></html>
+
+
+ remember password
+
+
+
============================================================
--- src/model/Keys.cpp 02497764e76e5dca25c68abdc2a106b84c28a86b
+++ src/model/Keys.cpp bac22fe33fe8e16f4ab76201d6f9b3cb527942de
@@ -18,6 +18,7 @@
#include "Keys.h"
#include "BasicIOParser.h"
+#include "Settings.h"
const int Key::Database = 1;
const int Key::Keystore = 2;
@@ -147,7 +148,7 @@ int Keys::columnCount(const QModelIndex
int Keys::columnCount(const QModelIndex & parent) const
{
Q_UNUSED(parent);
- return 5;
+ return 6;
}
QVariant Keys::data(const QModelIndex & index, int role) const
@@ -174,6 +175,7 @@ QVariant Keys::data(const QModelIndex &
case 2: return QVariant(key->local_name);
case 3: return QVariant(getLocationString(key->public_locations));
case 4: return QVariant(getLocationString(key->private_locations));
+ case 5: return QVariant(getPasswordSaveStatus(key));
}
return QVariant();
@@ -189,6 +191,15 @@ QString Keys::getLocationString(int loc)
return str.join(", ");
}
+QString Keys::getPasswordSaveStatus(Key * key) const
+{
+ if (!key->isPrivate())
+ return tr("-");
+ if (Settings::getItemFromMap("KeyPasswords", key->hash).isNull())
+ return tr("No");
+ return tr("Yes");
+}
+
Qt::ItemFlags Keys::flags(const QModelIndex & index) const
{
Q_UNUSED(index);
@@ -206,6 +217,7 @@ QVariant Keys::headerData(int section, Q
case 2: return QVariant(tr("Local Name"));
case 3: return QVariant(tr("Public Locations"));
case 4: return QVariant(tr("Private Locations"));
+ case 5: return QVariant(tr("Password saved?"));
}
}
return QVariant();
============================================================
--- src/model/Keys.h 3131df73288c46a0f22f82d5490e5a184666d9a1
+++ src/model/Keys.h 9f6df7cf905951771dbb4f1cc1a49117a43c2e34
@@ -32,6 +32,7 @@ struct Key {
int public_locations;
int private_locations;
Key() : public_locations(0), private_locations(0) {};
+ bool isPrivate() { return (private_locations & Keystore) == Keystore; }
};
class Keys : public QAbstractItemModel, public AutomateCommand
@@ -59,6 +60,7 @@ private:
private:
void processTaskResult(const MonotoneTaskPtr &);
QString getLocationString(int) const;
+ QString getPasswordSaveStatus(Key *) const;
QList keys;
DatabaseFile databaseFile;
};
============================================================
--- src/view/dialogs/GenerateKeypair.cpp ed77400baeffdea21382a03f2dd29d33dd33085c
+++ src/view/dialogs/GenerateKeypair.cpp a5ecff9abb5c83a965e3c782c424004819a6f708
@@ -18,6 +18,8 @@
#include "GenerateKeypair.h"
#include "MonotoneUtil.h"
+#include "Settings.h"
+#include "BasicIOParser.h"
#include
#include
@@ -79,12 +81,38 @@ void GenerateKeypair::accept()
this,
tr("Error creating keypair"),
tr("There was an error creating the keypair:\n%1")
- .arg(task->getDecodedOutput()),
+ .arg(task->getLast(MonotoneTask::Error)),
QMessageBox::Ok, 0, 0
);
return;
}
+ if (rememberPassword->isChecked())
+ {
+ BasicIOParser parser(task->getDecodedOutput());
+ I(parser.parse());
+ StanzaList stanzas = parser.getStanzas();
+ I(stanzas.size() == 1);
+ Stanza st = stanzas.at(0);
+ I(st.size() > 1);
+ I(st.at(1).sym == "hash" && !st.at(1).hash.isEmpty());
+
+ Settings::addItemToMap(
+ "KeyPasswords",
+ st.at(1).hash,
+ lineKeyPasswd->text()
+ );
+
+ QMessageBox::information(
+ this,
+ tr("Password saved"),
+ tr("Your key password has been saved. Please note that you "
+ "need to re-open the database or workspace you want to "
+ "use this key with."),
+ QMessageBox::Ok
+ );
+ }
+
emit keypairGenerated();
done(QDialog::Accepted);
}
============================================================
--- src/view/dialogs/KeyManagement.cpp 4bbfdd2899ac31e85629ccf5e0f48d4810e2e08f
+++ src/view/dialogs/KeyManagement.cpp c282dc5376939e8814d89faeb099d5b677e2d07b
@@ -222,6 +222,8 @@ void KeyManagement::dropKey()
return;
}
+ Settings::removeItemFromMap("KeyPasswords", key->hash);
+
model->readKeys();
}