# # # patch "guitone/res/dialogs/key_management.ui" # from [3506120945aedbed88014c179992e12288b2c18e] # to [11be469f0548a6d971dc0ca88e2fe9357681e21e] # # patch "guitone/res/i18n/guitone_de.ts" # from [21a02963c18f58e2faa062ea2e906659b102f643] # to [466778e4a4cdaaf9faa38bcfc5544fe1a76cb74c] # # patch "guitone/src/model/Keys.cpp" # from [6ac683b3c0c133e255d5f0328b9eb1bda43ef1ed] # to [f030f2ff2552a77a260dfe5f36b6b19b81f80b96] # # patch "guitone/src/model/Keys.h" # from [ea3bff0fa4f455b6d2bf2059e5d92a727bf5db49] # to [918e8c53b8994f8634f4ae56caa83c408b855532] # # patch "guitone/src/view/Guitone.cpp" # from [a3975cbce83cba1d70fb34d5c93f81436d7adbe7] # to [b99995d4a55005ac23cecbc349e04e87259f7c62] # # patch "guitone/src/view/dialogs/GenerateKeypair.cpp" # from [2d2fc5ea589723352a43e9c2e1d5de2f84a3b670] # to [b76e5bd51f9d69b7373755a4928c04eaeba14aaf] # # patch "guitone/src/view/dialogs/KeyManagement.cpp" # from [951bd9877d1139799576ce23791a52b893a928a7] # to [f5f5ee8b5c5836cd633e4395af8aad29e1d72c18] # # patch "guitone/src/view/dialogs/KeyManagement.h" # from [2a9c474f5e82803bc96dd0f08901a41466c48236] # to [9bb9738009da24459af5fe634e8a200bcab6d0c0] # # patch "guitone/src/view/dialogs/SwitchWorkspaceRevision.cpp" # from [6211ee0e88fd910624de1bbb5420cbefca1797c2] # to [d05cbd2c11e69ea1bed9e1c6664c5d29af6fe16f] # ============================================================ --- guitone/res/dialogs/key_management.ui 3506120945aedbed88014c179992e12288b2c18e +++ guitone/res/dialogs/key_management.ui 11be469f0548a6d971dc0ca88e2fe9357681e21e @@ -59,13 +59,6 @@ - - - Show signed Revisions - - - - Qt::Horizontal @@ -102,7 +95,6 @@ keyList closeButton generateKey - showSignedRevisions ============================================================ --- guitone/res/i18n/guitone_de.ts 21a02963c18f58e2faa062ea2e906659b102f643 +++ guitone/res/i18n/guitone_de.ts 466778e4a4cdaaf9faa38bcfc5544fe1a76cb74c @@ -190,12 +190,12 @@ Error executing command - Fehler bei der Kommandoausführung + Fehler bei der Kommandoausführung Unable to execute key creation command - maybe another process is still running? - Kann Kommando zur Schlüsselerzeugung nicht ausführen - eventuell läuft noch ein anderer Prozess? + Kann Kommando zur Schlüsselerzeugung nicht ausführen - eventuell läuft noch ein anderer Prozess? @@ -209,6 +209,16 @@ Bei der Erzeugung des Schlüsselpaares ist ein Fehler aufgetreten: %1 + + + Unable to execute command + Konnte Kommando nicht ausführen + + + + Unable to execute '%1' - maybe another command is still running? + Konnte '%1' nicht ausführen - eventuell läuft noch ein anderes Kommando? + GetFile @@ -278,12 +288,12 @@ Inventory could not be read - Inventar konnte nicht gelesen werden + Inventar konnte nicht gelesen werden The inventory could not be read. Maybe another task is still running? - Das Inventar konnte nicht gelesen werden. Vielleicht läuft noch ein anderer Prozess? + Das Inventar konnte nicht gelesen werden. Vielleicht läuft noch ein anderer Prozess? @@ -408,6 +418,16 @@ &Key Management &Schlüsselverwaltung + + + Unable to execute command + Konnte Kommando nicht ausführen + + + + Unable to execute '%1' - maybe another command is still running? + Konnte '%1' nicht ausführen - eventuell läuft noch ein anderes Kommando? + Inventory @@ -631,13 +651,38 @@ Show signed Revisions - Zeige signierte Revisionen + Zeige signierte Revisionen - + Close Schliessen + + + Unable to execute command + Konnte Kommando nicht ausführen + + + + Copy key name to clipboard + Kopiere Schlüsselnamen in die Zwischenablage + + + + Copy public key hash to clipboard + Kopiere öffentliche Prüfsumme in die Zwischenablage + + + + Copy public key data to clipboard + Kopiere öffentliche Schlüsseldaten in die Zwischenablage + + + + Unable to execute '%1' - maybe another command is still running? + Konnte '%1' nicht ausführen - eventuell läuft noch ein anderes Kommando? + KeyManagment @@ -690,37 +735,37 @@ Keys - + Database Datenbank - + Keystore Schlüsselspeicher - + Name Name - + Public Hash Öffentliche Prüfsumme - + Private Hash Private Prüfsumme - + Public Locations Öffentliche Speicherorte - + Private Locations Private Speicherorte @@ -783,17 +828,17 @@ korrekt installiert? korrekt installiert? - + Unable to process command '%1': %2 Das Kommando '%1' konnte nicht abgearbeitet werden: %2 - + Monotone failed to start (Code %1). Please configure the path in the Preferences dialog. Monotone konnte nicht gestartet werden (Code %1). Bitte konfigurieren Sie den Pfad im Eintellungsdialog. - + The connection to the monotone process was terminated (Code %1). Check your configuration and reload the current workspace afterwards. Die Verbindung zum monotone-Prozess wurde beendet (Code %1). Prüfen Sie Ihre Konfiguration und laden Sie ggf. den Arbeitsbereich danach neu. @@ -1093,12 +1138,12 @@ korrekt installiert? Revision list could not be read - Revisions-Liste konnte nicht gelesen werden + Revisions-Liste konnte nicht gelesen werden The revision list could not be read. Maybe another task is still running? - Die Liste der Revisionen konnte nicht gelesen werden. Eventuell ist noch ein anderer Prozess aktiv? + Die Liste der Revisionen konnte nicht gelesen werden. Eventuell ist noch ein anderer Prozess aktiv? @@ -1115,6 +1160,16 @@ korrekt installiert? Combined Kombiniert + + + Unable to execute command + Konnte Kommando nicht ausführen + + + + Unable to execute '%1' - maybe another command is still running? + Konnte '%1' nicht ausführen - eventuell läuft noch ein anderes Kommando? + Tags ============================================================ --- guitone/src/model/Keys.cpp 6ac683b3c0c133e255d5f0328b9eb1bda43ef1ed +++ guitone/src/model/Keys.cpp f030f2ff2552a77a260dfe5f36b6b19b81f80b96 @@ -28,18 +28,16 @@ Keys::Keys(QObject *parent) Keys::Keys(QObject *parent) : AutomateCommand(parent) { - keys = new KeyList(); } Keys::~Keys() { - keys->clear(); - delete keys; + keys.clear(); } bool Keys::readKeys() { - keys->clear(); + keys.clear(); reset(); QStringList cmd; @@ -57,12 +55,13 @@ void Keys::parseOutput(AutomateCommand * StanzaParser* parser = new StanzaParser(AutomateCommand::data); StanzaList list = parser->getStanzas(); - + Key * key; + for (int i=0, size = list.size(); i < size; ++i) { Stanza stanza = list.at(i); - Key key; + key = new Key(); bool isItem = false; for (int j=0, size2 = stanza.size(); j < size2; j++) @@ -77,21 +76,21 @@ void Keys::parseOutput(AutomateCommand * if (entry.sym == "name") { Q_ASSERT(entry.vals.size() == 1); - key.name = entry.vals.at(0); + key->name = entry.vals.at(0); continue; } if (entry.sym == "public_hash") { Q_ASSERT(entry.vals.size() == 1); - key.public_hash = entry.vals.at(0); + key->public_hash = entry.vals.at(0); continue; } if (entry.sym == "private_hash") { Q_ASSERT(entry.vals.size() == 1); - key.private_hash = entry.vals.at(0); + key->private_hash = entry.vals.at(0); continue; } @@ -101,13 +100,13 @@ void Keys::parseOutput(AutomateCommand * { if (entry.vals.at(k) == "database") { - key.public_locations |= Key::Database; + key->public_locations |= Key::Database; continue; } if (entry.vals.at(k) == "keystore") { - key.public_locations |= Key::Keystore; + key->public_locations |= Key::Keystore; continue; } @@ -125,13 +124,13 @@ void Keys::parseOutput(AutomateCommand * { if (entry.vals.at(k) == "database") { - key.private_locations |= Key::Database; + key->private_locations |= Key::Database; continue; } if (entry.vals.at(k) == "keystore") { - key.private_locations |= Key::Keystore; + key->private_locations |= Key::Keystore; continue; } @@ -148,7 +147,7 @@ void Keys::parseOutput(AutomateCommand * // check if we really processed an item entry if (!isItem) continue; - keys->append(key); + keys.append(key); } reset(); @@ -173,17 +172,17 @@ QVariant Keys::data(const QModelIndex &i } int row = index.row(); - if (row >= keys->size()) return QVariant(); + if (row >= keys.size()) return QVariant(); - Key key = keys->at(row); + Key * key = keys.at(row); switch (index.column()) { - case 0: return QVariant(key.name); - case 1: return QVariant(key.public_hash); - case 2: return QVariant(key.private_hash); - case 3: return QVariant(getLocationString(key.public_locations)); - case 4: return QVariant(getLocationString(key.private_locations)); + case 0: return QVariant(key->name); + case 1: return QVariant(key->public_hash); + case 2: return QVariant(key->private_hash); + case 3: return QVariant(getLocationString(key->public_locations)); + case 4: return QVariant(getLocationString(key->private_locations)); } return QVariant(); @@ -222,12 +221,19 @@ int Keys::rowCount(const QModelIndex& pa int Keys::rowCount(const QModelIndex& parent) const { - return keys->size(); + return keys.size(); } QModelIndex Keys::index(int row, int column, const QModelIndex& parent) const { - return hasIndex(row, column, parent) ? createIndex(row, column, 0) : QModelIndex(); + if (!hasIndex(row, column, parent)) + { + return QModelIndex(); + } + + if (row >= keys.size()) return QModelIndex(); + Key * key = keys.at(row); + return createIndex(row, column, key); } QModelIndex Keys::parent(const QModelIndex& index) const ============================================================ --- guitone/src/model/Keys.h ea3bff0fa4f455b6d2bf2059e5d92a727bf5db49 +++ guitone/src/model/Keys.h 918e8c53b8994f8634f4ae56caa83c408b855532 @@ -33,7 +33,7 @@ struct Key { int private_locations; Key() : public_locations(0), private_locations(0) {}; }; -typedef QList KeyList; +typedef QList KeyList; class Keys : public AutomateCommand { @@ -60,7 +60,7 @@ private: private: void parseOutput(AutomateCommand*); QString getLocationString(int) const; - KeyList * keys; + KeyList keys; }; #endif ============================================================ --- guitone/src/view/Guitone.cpp a3975cbce83cba1d70fb34d5c93f81436d7adbe7 +++ guitone/src/view/Guitone.cpp b99995d4a55005ac23cecbc349e04e87259f7c62 @@ -304,8 +304,8 @@ void Guitone::loadWorkspace(QString fn) { QMessageBox::information( this, - tr("Inventory could not be read"), - tr("The inventory could not be read. Maybe another task is still running?"), + tr("Unable to execute command"), + tr("Unable to execute '%1' - maybe another command is still running?").arg("inventory"), QMessageBox::Ok ); return; ============================================================ --- guitone/src/view/dialogs/GenerateKeypair.cpp 2d2fc5ea589723352a43e9c2e1d5de2f84a3b670 +++ guitone/src/view/dialogs/GenerateKeypair.cpp b76e5bd51f9d69b7373755a4928c04eaeba14aaf @@ -68,8 +68,8 @@ void GenerateKeypair::accept() { QMessageBox::critical( this, - tr("Error executing command"), - tr("Unable to execute key creation command - maybe another process is still running?"), + tr("Unable to execute command"), + tr("Unable to execute '%1' - maybe another command is still running?").arg("genkey"), QMessageBox::Ok, 0, 0 ); return; ============================================================ --- guitone/src/view/dialogs/KeyManagement.cpp 951bd9877d1139799576ce23791a52b893a928a7 +++ guitone/src/view/dialogs/KeyManagement.cpp f5f5ee8b5c5836cd633e4395af8aad29e1d72c18 @@ -23,6 +23,11 @@ #include "../../util/Settings.h" #include "../../monotone/Monotone.h" +#include +#include +#include +#include + KeyManagement::KeyManagement(QWidget* parent) : QDialog(parent) { @@ -30,25 +35,37 @@ KeyManagement::KeyManagement(QWidget* pa model = new Keys(this); keyList->setModel(model); - // FIXME: error handling! - model->readKeys(); - showSignedRevisions->setEnabled(false); + if (!model->readKeys()) + { + QMessageBox::critical( + this, + tr("Unable to execute command"), + tr("Unable to execute '%1' - maybe another command is still running?").arg("keys"), + QMessageBox::Ok + ); + QTimer::singleShot(0, this, SLOT(reject())); + return; + } connect( generateKey, SIGNAL(clicked()), this, SLOT(generateKeypair()) ); - connect( - showSignedRevisions, SIGNAL(clicked()), - this, SLOT(triggerRevisionDialog()) - ); + popupMenu = new QMenu(this); - connect( - keyList, SIGNAL(clicked(const QModelIndex &)), - this, SLOT(enableDisableShowSignedRevButton(const QModelIndex &)) - ); + QAction * act = new QAction(tr("Copy key name to clipboard"), this); + connect(act, SIGNAL(triggered()), this, SLOT(copyKeyNameToClipboard())); + popupMenu->addAction(act); + + act = new QAction(tr("Copy public key hash to clipboard"), this); + connect(act, SIGNAL(triggered()), this, SLOT(copyPubkeyHashToClipboard())); + popupMenu->addAction(act); + + act = new QAction(tr("Copy public key data to clipboard"), this); + connect(act, SIGNAL(triggered()), this, SLOT(copyPubkeyDataToClipboard())); + popupMenu->addAction(act); } KeyManagement::~KeyManagement() {} @@ -63,26 +80,39 @@ void KeyManagement::generateKeypair() } } -void KeyManagement::enableDisableShowSignedRevButton(const QModelIndex & index) +void KeyManagement::contextMenuEvent(QContextMenuEvent* ev) { - if (!index.isValid()) - { - showSignedRevisions->setEnabled(false); - return; - } + QItemSelectionModel* selection = keyList->selectionModel(); + QList indexList = selection->selectedIndexes(); + if (indexList.size() == 0) return; - QString key(index.data().toString()); - if (key.size() == 0) - { - showSignedRevisions->setEnabled(false); - return; - } - - showSignedRevisions->setEnabled(true); + popupMenu->exec(mapToGlobal(ev->pos())); } -void KeyManagement::triggerRevisionDialog() +Key * KeyManagement::getKeyFromSelection() const { - qDebug("KeyManagement::triggerRevisionDialog: TODO: Show revision dialog"); + QItemSelectionModel* selection = keyList->selectionModel(); + QList indexList = selection->selectedIndexes(); + // we're only interested in the first column's internal pointer + return static_cast(indexList[0].internalPointer()); } +void KeyManagement::copyKeyNameToClipboard() +{ + Key * key = getKeyFromSelection(); + QClipboard * clipboard = QApplication::clipboard(); + clipboard->setText(key->name); +} + +void KeyManagement::copyPubkeyHashToClipboard() +{ + Key * key = getKeyFromSelection(); + QClipboard * clipboard = QApplication::clipboard(); + clipboard->setText(key->public_hash); +} + +void KeyManagement::copyPubkeyDataToClipboard() +{ + qDebug("KeyManagement::copyPubkeyDataToClipboard: no automate pubkey available!"); +} + ============================================================ --- guitone/src/view/dialogs/KeyManagement.h 2a9c474f5e82803bc96dd0f08901a41466c48236 +++ guitone/src/view/dialogs/KeyManagement.h 9bb9738009da24459af5fe634e8a200bcab6d0c0 @@ -24,6 +24,9 @@ #include "../../model/Keys.h" #include "ui_key_management.h" +#include +#include + class KeyManagement : public QDialog, private Ui::KeyManagement { Q_OBJECT @@ -31,14 +34,19 @@ public: public: KeyManagement(QWidget*); ~KeyManagement(); + void contextMenuEvent(QContextMenuEvent* ev); private: + Key * getKeyFromSelection() const; + Keys * model; + QMenu * popupMenu; private slots: void generateKeypair(); - void enableDisableShowSignedRevButton(const QModelIndex &); - void triggerRevisionDialog(); + void copyKeyNameToClipboard(); + void copyPubkeyHashToClipboard(); + void copyPubkeyDataToClipboard(); }; #endif ============================================================ --- guitone/src/view/dialogs/SwitchWorkspaceRevision.cpp 6211ee0e88fd910624de1bbb5420cbefca1797c2 +++ guitone/src/view/dialogs/SwitchWorkspaceRevision.cpp d05cbd2c11e69ea1bed9e1c6664c5d29af6fe16f @@ -124,14 +124,14 @@ void SwitchWorkspaceRevision::triggerRev selector.append(":"); } - selector.append(selectorValue->text()); //.replace('/', "\\/")); + selector.append(selectorValue->text()); if (!selectorModel->readSelection(selector)) { QMessageBox::warning( this, - tr("Revision list could not be read"), - tr("The revision list could not be read. Maybe another task is still running?"), + tr("Unable to execute command"), + tr("Unable to execute '%1' - maybe another command is still running?").arg("select"), QMessageBox::Ok ); return;