# # # patch "src/view/dialogs/GenerateKeypair.cpp" # from [8545fc450ce54de48a640ce3f7981c0654b220df] # to [8a4eec3caa92df509a09a417e6270b5b8ff3a051] # # patch "src/view/dialogs/GenerateKeypair.h" # from [898590bc59420b56dab41d58bf2689ea618d1cb0] # to [cebede2191e82f9b8a86774ab306a46d30babaf3] # ============================================================ --- src/view/dialogs/GenerateKeypair.cpp 8545fc450ce54de48a640ce3f7981c0654b220df +++ src/view/dialogs/GenerateKeypair.cpp 8a4eec3caa92df509a09a417e6270b5b8ff3a051 @@ -19,17 +19,17 @@ ***************************************************************************/ #include "GenerateKeypair.h" -#include "Guitone.h" +#include "MonotoneUtil.h" #include #include -GenerateKeypair::GenerateKeypair(QWidget* parent) - : Dialog(parent) +GenerateKeypair::GenerateKeypair(QWidget * parent, const DatabaseFile & db) + : Dialog(parent), databaseFile(db) { setupUi(this); Dialog::init(); - + // OSX sheet-alike dialog setWindowFlags(Qt::Sheet); } @@ -50,7 +50,7 @@ void GenerateKeypair::accept() ); return; } - + if (lineKeyPasswd->text().compare(lineKeyPasswd2->text()) != 0) { QMessageBox::information( @@ -61,37 +61,28 @@ void GenerateKeypair::accept() ); return; } - - int commandNumber; - QStringList cmd; - cmd << "genkey" << lineKeyName->text() << lineKeyPasswd->text(); - - Monotone * mtn = MTN(this); - - if (!mtn->executeCommand(cmd, commandNumber)) + + MonotoneTask out = MonotoneUtil::runSynchronousDatabaseTask( + databaseFile, + MonotoneTask(QStringList() << "genkey" + << lineKeyName->text() + << lineKeyPasswd->text() + ) + ); + if (!out.isFinished()) F("task aborted"); + + if (out.getReturnCode() > 0) { - QMessageBox::critical( - this, - tr("Unable to execute command"), - tr("Unable to execute '%1' - maybe another command is still running?").arg("genkey"), - QMessageBox::Ok, 0, 0 - ); - return; - } - - QString msg = mtn->getDecodedData(commandNumber); - - if (mtn->getReturnCode(commandNumber) > 0) - { QMessageBox::critical( this, tr("Error creating keypair"), - tr("There was an error creating the keypair:\n%1").arg(msg), + tr("There was an error creating the keypair:\n%1") + .arg(out.getOutputUtf8()), QMessageBox::Ok, 0, 0 ); return; } - + done(QDialog::Accepted); } ============================================================ --- src/view/dialogs/GenerateKeypair.h 898590bc59420b56dab41d58bf2689ea618d1cb0 +++ src/view/dialogs/GenerateKeypair.h cebede2191e82f9b8a86774ab306a46d30babaf3 @@ -22,18 +22,21 @@ #define GENERATEKEYPAIR_H #include "Dialog.h" +#include "vocab.h" #include "ui_generate_keypair.h" class GenerateKeypair : public Dialog, private Ui::GenerateKeypair { - Q_OBJECT - + Q_OBJECT public: - GenerateKeypair(QWidget*); - ~GenerateKeypair(); - + GenerateKeypair(QWidget *, const DatabaseFile &); + ~GenerateKeypair(); + public slots: void accept(); + +private: + DatabaseFile databaseFile; }; #endif