#
#
# add_file "res/forms/dialogs/create_cert.ui"
# content [71eaa2f7fce2a6ee447593d7c87833174c078b8f]
#
# add_file "src/view/dialogs/CreateCert.cpp"
# content [05238fd66b0cee0254fee998b842d86ca318dfc8]
#
# add_file "src/view/dialogs/CreateCert.h"
# content [01ecab2ec3ad9bdd66c164f6ef547749079d1230]
#
# patch "guitone.pro"
# from [f07ec519dc3fc24313bd671f69708a393d35a2da]
# to [21df76248280eb2b9d4674d5417cbccf327b8cde]
#
# patch "src/view/dialogs/DatabaseDialogManager.cpp"
# from [942816eb7be7e84aa457ce2209f3d8e8a3276ae0]
# to [8ee187423848967f7ac8ed5155761d5033da7506]
#
# patch "src/view/dialogs/DatabaseDialogManager.h"
# from [b52f6da5ed64a9f9b354f0843e5e013a177ca23b]
# to [54603a3a6e7ef08dc551533ef451e75e517e6a33]
#
============================================================
--- res/forms/dialogs/create_cert.ui 71eaa2f7fce2a6ee447593d7c87833174c078b8f
+++ res/forms/dialogs/create_cert.ui 71eaa2f7fce2a6ee447593d7c87833174c078b8f
@@ -0,0 +1,138 @@
+
+
+ CreateCertDialog
+
+
+
+ 0
+ 0
+ 397
+ 248
+
+
+
+ Create a new certificate
+
+
+ -
+
+
-
+
+
+ Revision
+
+
+
+ -
+
+
-
+
+
+ true
+
+
+
+ -
+
+
+ Select
+
+
+
+
+
+ -
+
+
-
+
+
+ false
+
+
+
+ -
+
+
+ false
+
+
+
+
+
+ -
+
+
-
+
+
+ -
+
+
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+ Sign with key
+
+
+
+ -
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ CreateCertDialog
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ CreateCertDialog
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
============================================================
--- src/view/dialogs/CreateCert.cpp 05238fd66b0cee0254fee998b842d86ca318dfc8
+++ src/view/dialogs/CreateCert.cpp 05238fd66b0cee0254fee998b842d86ca318dfc8
@@ -0,0 +1,108 @@
+/***************************************************************************
+ * Copyright (C) 2010 by Thomas Keller *
+ * 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 3 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, see . *
+ ***************************************************************************/
+
+#include "CreateCert.h"
+#include "MonotoneUtil.h"
+
+CreateCert::CreateCert(QWidget * parent, const DatabaseFile & db)
+ : Dialog(parent), database(db)
+{
+ setupUi(this);
+ Dialog::init();
+
+ name->addItem(tr("Tag"), "tag");
+ name->addItem(tr("Test result"), "testresult");
+ name->addItem(tr("Comment"), "comment");
+ name->addItem(tr("Custom..."), "");
+
+ type->addItem(tr("single line"), "single");
+ type->addItem(tr("multi line"), "multi");
+ type->addItem(tr("boolean"), "boolean");
+
+ nameTypeMap.insert("tag", "single");
+ nameTypeMap.insert("testresult", "boolean");
+ nameTypeMap.insert("comment", "multi");
+
+ typeWidgetMap.insert("single", singleLineValue);
+ typeWidgetMap.insert("multi", multiLineValue);
+ typeWidgetMap.insert("boolean", booleanValue);
+
+ connect(
+ name, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(nameIndexChanged(int))
+ );
+
+ init();
+}
+
+CreateCert::~CreateCert() {}
+
+void CreateCert::init(const QString & certName)
+{
+ signingKey->clear();
+
+ QMap privateKeys =
+ MonotoneUtil::getPrivateKeyMap(db);
+
+ QMapIterator it(privateKeys);
+ for (; it.hasNext(); it.next())
+ {
+ signingKey->addItem(it.value(), it.key());
+ }
+
+ selectCertName(certName);
+}
+
+void CreateCert::selectCertName(const QString & name)
+{
+ bool knownName = nameTypeMap.contains(name);
+ QString typeValue = knownName ? nameTypeMap.value(name) : "single";
+
+ int pos = type->findData(typeValue);
+ I(pos >= 0);
+
+ type->setCurrentIndex(pos);
+ type->setEnabled(!knownName);
+
+ QMapIterator it(typeWidgetMap);
+ for (; it.hasNext(); it.next())
+ {
+ it.value()->setVisible(false);
+ }
+
+ I(typeWidgetMap.contains(typeValue));
+ typeWidgetMap.value(typeValue)->setVisible(true);
+
+ if (!knownName)
+ {
+ name->setEditable(true);
+ name->setCurrentText("x-");
+ }
+ else
+ {
+ name->setEditable(false);
+ }
+}
+
+void CreateCert::nameIndexChanged(int pos)
+{
+ QVariant var = name->itemData(pos);
+ QString certName = var.isValid() ? var.toString() : "";
+ selectCertName(certName);
+}
+
============================================================
--- src/view/dialogs/CreateCert.h 01ecab2ec3ad9bdd66c164f6ef547749079d1230
+++ src/view/dialogs/CreateCert.h 01ecab2ec3ad9bdd66c164f6ef547749079d1230
@@ -0,0 +1,56 @@
+/***************************************************************************
+ * Copyright (C) 2010 by Thomas Keller *
+ * 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 3 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, see . *
+ ***************************************************************************/
+
+#ifndef CREATECERT_H
+#define CREATECERT_H
+
+#include "ui_create_cert.h"
+#include "Dialog.h"
+#include "vocab.h"
+
+#include
+
+class CreateCert : public Dialog, private Ui::CreateCertDialog
+{
+ Q_OBJECT
+
+public:
+ CreateCert(QWidget *, const DatabaseFile &);
+ ~CreateCert();
+
+ void init(const QString & certName = QString());
+
+signals:
+ void selectRevision();
+
+public slots:
+ void selectCertName(const QString &);
+ void setSelectedRevision(const QString &);
+
+private:
+ QMap nameTypeMap;
+ QMap typeWidgetMap;
+
+ DatabaseFile database;
+
+private slots:
+ void nameIndexChanged(int index);
+};
+
+#endif
+
============================================================
--- guitone.pro f07ec519dc3fc24313bd671f69708a393d35a2da
+++ guitone.pro 21df76248280eb2b9d4674d5417cbccf327b8cde
@@ -113,6 +113,7 @@ HEADERS = src/view/widgets/TreeView.h \
src/view/dialogs/NewProjectSetup.h \
src/view/dialogs/Message.h \
src/view/dialogs/AnnotateFile.h \
+ src/view/dialogs/CreateCert.h \
src/view/panels/IconHelp.h \
src/view/panels/DatabaseVariables.h \
src/view/panels/NodeInfo.h \
@@ -208,6 +209,7 @@ SOURCES += src/view/widgets/TreeView.cpp
src/view/dialogs/NewProjectSetup.cpp \
src/view/dialogs/Message.cpp \
src/view/dialogs/AnnotateFile.cpp \
+ src/view/dialogs/CreateCert.cpp \
src/view/panels/IconHelp.cpp \
src/view/panels/DatabaseVariables.cpp \
src/view/panels/NodeInfo.cpp \
@@ -281,6 +283,7 @@ FORMS += res/forms/dialogs/select_revi
res/forms/dialogs/netsync.ui \
res/forms/dialogs/new_project_setup.ui \
res/forms/dialogs/annotate.ui \
+ res/forms/dialogs/create_cert.ui \
res/forms/panels/icon_help.ui \
res/forms/panels/db_variables.ui \
res/forms/panels/nodeinfo.ui
============================================================
--- src/view/dialogs/DatabaseDialogManager.cpp 942816eb7be7e84aa457ce2209f3d8e8a3276ae0
+++ src/view/dialogs/DatabaseDialogManager.cpp 8ee187423848967f7ac8ed5155761d5033da7506
@@ -24,7 +24,7 @@ DatabaseDialogManager::DatabaseDialogMan
checkoutRevision(0), fileDiff(0), fileHistory(0), generateKeypair(0),
netsync(0), keyManagement(0), revisionDiff(0),
revisionManifest(0), selectRevision(0), newProjectSetup(0),
- annotateFile(0)
+ annotateFile(0), createCert(0)
{}
DatabaseDialogManager::~DatabaseDialogManager()
@@ -46,6 +46,7 @@ void DatabaseDialogManager::cleanup()
if (selectRevision) { delete selectRevision; selectRevision = 0; }
if (newProjectSetup) { delete newProjectSetup; newProjectSetup = 0; }
if (annotateFile) { delete annotateFile; annotateFile = 0; }
+ if (createCert) { delete createCert; createCert = 0; }
}
void DatabaseDialogManager::closeAllDialogs()
@@ -62,6 +63,7 @@ void DatabaseDialogManager::closeAllDial
if (selectRevision) selectRevision->close();
if (newProjectSetup) newProjectSetup->close();
if (annotateFile) annotateFile->close();
+ if (createCert) createCert->close();
DialogManager::closeAllDialogs();
}
@@ -337,3 +339,24 @@ void DatabaseDialogManager::showAnnotati
showDialog(annotateFile);
}
+void DatabaseDialogManager::showCreateCert(const QString & rev, const QString & certName)
+{
+ if (!createCert)
+ {
+ createCert = new CreateCert(parentWidget(), databaseFile);
+
+ connect(
+ createCert, SIGNAL(selectRevision()),
+ this, SLOT(showSelectRevision())
+ );
+
+ connect(
+ this, SIGNAL(revisionSelected(const QString &)),
+ createCert, SLOT(setSelectedRevision(const QString &))
+ );
+ }
+
+ createCert->init(certName);
+ showDialog(createCert);
+}
+
============================================================
--- src/view/dialogs/DatabaseDialogManager.h b52f6da5ed64a9f9b354f0843e5e013a177ca23b
+++ src/view/dialogs/DatabaseDialogManager.h 54603a3a6e7ef08dc551533ef451e75e517e6a33
@@ -32,6 +32,7 @@
#include "SelectRevision.h"
#include "NewProjectSetup.h"
#include "AnnotateFile.h"
+#include "CreateCert.h"
class DatabaseDialogManager : public DialogManager
{
@@ -64,6 +65,7 @@ public slots:
void showSelectRevision();
void showSelectRevision(const QString & selector);
void showAnnotation(const QString &, const QString &);
+ void showCreateCert(const QString & rev, const QString & certName = QString());
protected:
ChangesetBrowser * changesetBrowser;
@@ -78,6 +80,7 @@ protected:
SelectRevision * selectRevision;
NewProjectSetup * newProjectSetup;
AnnotateFile * annotateFile;
+ CreateCert * createCert;
private:
void cleanup();