# # # add_file "guitone/res/dialogs/generate_keypair.ui" # content [e128bf1309c9ba6f8cc4cc0f6ae5c79e963b0892] # # add_file "guitone/src/view/dialogs/GenerateKeypair.cpp" # content [2d2fc5ea589723352a43e9c2e1d5de2f84a3b670] # # add_file "guitone/src/view/dialogs/GenerateKeypair.h" # content [f671f4f3d53c0986c773060a23807f689207b74f] # # patch "guitone/guitone.pro" # from [c82b4a4df92e8799477921d981d51b28bfd768cb] # to [5bd80b82a718f83b2d28c60a5c8de9d78d06811a] # # patch "guitone/res/i18n/guitone_de.ts" # from [05e0ff4668c37e8b07f8f745bedca6a673e9a6b5] # to [21a02963c18f58e2faa062ea2e906659b102f643] # # patch "guitone/src/view/dialogs/KeyManagement.cpp" # from [d370e0b83f27bb75d78dc4f352e6766f9e307a4a] # to [1f3f610c94977d23ec71d4594f67fbb7c12a19c9] # # patch "guitone/src/view/dialogs/KeyManagement.h" # from [7e7ae87bdbf2c21c29d2cecd726fdcede80bc353] # to [3b0c26ad17584fac59b0e3dbdaea8bc0fc7e00ae] # ============================================================ --- guitone/res/dialogs/generate_keypair.ui e128bf1309c9ba6f8cc4cc0f6ae5c79e963b0892 +++ guitone/res/dialogs/generate_keypair.ui e128bf1309c9ba6f8cc4cc0f6ae5c79e963b0892 @@ -0,0 +1,173 @@ + + GenerateKeypair + + + Qt::WindowModal + + + true + + + + 0 + 0 + 335 + 136 + + + + + 5 + 5 + 0 + 0 + + + + + 0 + 0 + + + + Generate new Keypair + + + false + + + false + + + + 9 + + + 6 + + + + + 0 + + + 6 + + + + + 0 + + + 6 + + + + + 0 + + + 6 + + + + + Key ID (e.g. email) + + + + + + + Password + + + + + + + Repeat password + + + + + + + + + 0 + + + 6 + + + + + + + + QLineEdit::Password + + + + + + + QLineEdit::Password + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + + + + + + + + + + buttonBox + accepted() + GenerateKeypair + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + GenerateKeypair + reject() + + + 316 + 260 + + + 286 + 274 + + + + + ============================================================ --- guitone/src/view/dialogs/GenerateKeypair.cpp 2d2fc5ea589723352a43e9c2e1d5de2f84a3b670 +++ guitone/src/view/dialogs/GenerateKeypair.cpp 2d2fc5ea589723352a43e9c2e1d5de2f84a3b670 @@ -0,0 +1,91 @@ +/*************************************************************************** + * Copyright (C) 2006 by Ingo Maindorfer * + * address@hidden * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "GenerateKeypair.h" +#include "../../monotone/Monotone.h" + +#include +#include + +GenerateKeypair::GenerateKeypair(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); +} + +GenerateKeypair::~GenerateKeypair() {} + +void GenerateKeypair::accept() +{ + if (lineKeyName->text().size() == 0 || + lineKeyPasswd->text().size() == 0 || + lineKeyPasswd2->text().size() == 0) + { + QMessageBox::information( + this, + tr("Missing information"), + tr("Please fill out all fields."), + QMessageBox::Ok + ); + return; + } + + if (lineKeyPasswd->text().compare(lineKeyPasswd2->text()) != 0) + { + QMessageBox::information( + this, + tr("Password mismatch"), + tr("The entered passwords did not match."), + QMessageBox::Ok + ); + return; + } + + QStringList cmd; + cmd << "genkey" << lineKeyName->text() << lineKeyPasswd->text(); + + Monotone * mtn = Monotone::singleton(); + + int retCode; + if (!mtn->executeCommand(cmd, retCode)) + { + QMessageBox::critical( + this, + tr("Error executing command"), + tr("Unable to execute key creation command - maybe another process is still running?"), + QMessageBox::Ok, 0, 0 + ); + return; + } + + if (retCode != 0) + { + QMessageBox::critical( + this, + tr("Error creating keypair"), + tr("There was an error creating the keypair:\n%1").arg(mtn->getOutput()), + QMessageBox::Ok, 0, 0 + ); + return; + } + + done(QDialog::Accepted); +} + ============================================================ --- guitone/src/view/dialogs/GenerateKeypair.h f671f4f3d53c0986c773060a23807f689207b74f +++ guitone/src/view/dialogs/GenerateKeypair.h f671f4f3d53c0986c773060a23807f689207b74f @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (C) 2006 by Ingo Maindorfer * + * address@hidden * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef GENERATEKEYPAIR_H +#define GENERATEKEYPAIR_H + +#include "ui_generate_keypair.h" + +class GenerateKeypair : public QDialog, private Ui::GenerateKeypair +{ + Q_OBJECT + +public: + GenerateKeypair(QWidget*); + ~GenerateKeypair(); + +public slots: + void accept(); +}; + +#endif ============================================================ --- guitone/guitone.pro c82b4a4df92e8799477921d981d51b28bfd768cb +++ guitone/guitone.pro 5bd80b82a718f83b2d28c60a5c8de9d78d06811a @@ -17,6 +17,7 @@ HEADERS += src/view/Guitone.h \ src/view/dialogs/AncestryGraph.h \ src/view/dialogs/FileDiff.h \ src/view/dialogs/KeyManagement.h \ + src/view/dialogs/GenerateKeypair.h \ src/monotone/Monotone.h \ src/model/AutomateCommand.h \ src/model/Inventory.h \ @@ -49,6 +50,7 @@ SOURCES += src/view/Guitone.cpp \ src/view/dialogs/AncestryGraph.cpp \ src/view/dialogs/FileDiff.cpp \ src/view/dialogs/KeyManagement.cpp \ + src/view/dialogs/GenerateKeypair.cpp \ src/monotone/Monotone.cpp \ src/model/AutomateCommand.cpp \ src/model/Inventory.cpp \ @@ -74,7 +76,8 @@ FORMS += res/dialogs/switch_workspace. res/dialogs/preferences.ui \ res/dialogs/ancestry_graph.ui \ res/dialogs/file_diff.ui \ - res/dialogs/key_management.ui + res/dialogs/key_management.ui \ + res/dialogs/generate_keypair.ui UI_DIR = src/view/dialogs OBJECTS_DIR = tmp MOC_DIR = tmp ============================================================ --- guitone/res/i18n/guitone_de.ts 05e0ff4668c37e8b07f8f745bedca6a673e9a6b5 +++ guitone/res/i18n/guitone_de.ts 21a02963c18f58e2faa062ea2e906659b102f643 @@ -146,19 +146,84 @@ + GenerateKeypair + + + Generate new Keypair + Neues Schlüsselpaar erzeugen + + + + Key ID (e.g. email) + Schlüssel-ID (z.B. E-Mail) + + + + Password + Passwort + + + + Repeat password + Passwort wiederholen + + + + Missing information + Fehlende Angaben + + + + Please fill out all fields. + Bitte füllen Sie alle Felder aus. + + + + Password mismatch + Keine Passwortübereinstimmung + + + + The entered passwords did not match. + Die eingegebenen Passwörter stimmen nicht überein. + + + + Error executing command + 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? + + + + Error creating keypair + Fehler beim Erzeugen des Schlüsselpaares + + + + There was an error creating the keypair: +%1 + Bei der Erzeugung des Schlüsselpaares ist ein Fehler aufgetreten: +%1 + + + GetFile - + File is binary. Datei ist eine Binärdatei. - + Line Zeile - + Content Inhalt @@ -718,7 +783,7 @@ korrekt installiert? korrekt installiert? - + Unable to process command '%1': %2 Das Kommando '%1' konnte nicht abgearbeitet werden: %2 ============================================================ --- guitone/src/view/dialogs/KeyManagement.cpp d370e0b83f27bb75d78dc4f352e6766f9e307a4a +++ guitone/src/view/dialogs/KeyManagement.cpp 1f3f610c94977d23ec71d4594f67fbb7c12a19c9 @@ -19,6 +19,7 @@ ***************************************************************************/ #include "KeyManagement.h" +#include "GenerateKeypair.h" #include "../../util/Settings.h" #include "../../monotone/Monotone.h" @@ -26,7 +27,12 @@ KeyManagement::KeyManagement(QWidget* pa : QDialog(parent) { setupUi(this); - + + connect( + generateKey, SIGNAL(clicked()), + this, SLOT(generateKeypair()) + ); + model = new Keys(this); keyList->setModel(model); @@ -36,3 +42,13 @@ KeyManagement::~KeyManagement() {} KeyManagement::~KeyManagement() {} +void KeyManagement::generateKeypair() +{ + GenerateKeypair dlg(this); + // if the key was successfully created, reload the key list + if (dlg.exec() == QDialog::Accepted) + { + model->readKeys(); + } +} + ============================================================ --- guitone/src/view/dialogs/KeyManagement.h 7e7ae87bdbf2c21c29d2cecd726fdcede80bc353 +++ guitone/src/view/dialogs/KeyManagement.h 3b0c26ad17584fac59b0e3dbdaea8bc0fc7e00ae @@ -34,6 +34,9 @@ private: private: Keys * model; + +private slots: + void generateKeypair(); }; #endif