#
#
# add_file "guitone/res/forms/manifest.ui"
# content [d645dc2d7505601fda16753cc6414600b74db603]
#
# add_file "guitone/src/view/dialogs/RevisionManifest.cpp"
# content [5a224c000a43c839dbd6294a438ba6afdec2b542]
#
# add_file "guitone/src/view/dialogs/RevisionManifest.h"
# content [5c1fb28b9275b8bd7c49500f3116f7e5ceff1921]
#
# patch "guitone/guitone.pro"
# from [fa6591e3761c27f496f59500e56dfa6cf9fcfbce]
# to [3e702820638e27442e7f8faee1acaad663c97f1b]
#
# patch "guitone/res/i18n/guitone_de.ts"
# from [cf253683411fe5f117013753b5e2c7d77c1f0310]
# to [5929ed1a92db7f99aea94ecff0b1466f0fe56875]
#
# patch "guitone/src/model/Certs.cpp"
# from [782481459f320468c583c3cb0c2d94844035790c]
# to [9f20b724cfd368645c3247179ddbb45e92b52d92]
#
# patch "guitone/src/model/Certs.h"
# from [b198dabe787ab4c0389557b74cfe8b6123a6e35b]
# to [17c33f34b4be6c0830c784574705dd74e42312ca]
#
# patch "guitone/src/model/Manifest.cpp"
# from [2f05aa8a463676daeba4d5a1be5d849cacd8b269]
# to [ef81008777f2af1572bdb6d3e877f3dbbb0ff5d5]
#
# patch "guitone/src/model/Manifest.h"
# from [e6d99d6259e723aa8aec62782c98db9d37d82f36]
# to [cf2dee4ff7a56821e2305cb6c08f7520ffa15df5]
#
# patch "guitone/src/view/dialogs/SwitchWorkspaceRevision.cpp"
# from [bb862eb7efcae41624d5af6a56493bf161600e46]
# to [a622d1e2fedd078e3307ca233bdf1298554de5a6]
#
# patch "guitone/src/view/dialogs/SwitchWorkspaceRevision.h"
# from [a0b1232436cc001948b1a9d11de0e598305505b9]
# to [4bd70e9d2d2583e5919f07072d3d581506c6f0b0]
#
============================================================
--- guitone/res/forms/manifest.ui d645dc2d7505601fda16753cc6414600b74db603
+++ guitone/res/forms/manifest.ui d645dc2d7505601fda16753cc6414600b74db603
@@ -0,0 +1,116 @@
+
+ ManifestDialog
+
+
+
+ 0
+ 0
+ 419
+ 368
+
+
+
+ Files in %1
+
+
+ :/icons/guitone.png
+
+
+
+ 9
+
+
+ 6
+
+ -
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ QAbstractItemView::MultiSelection
+
+
+
+ -
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ Save selected
+
+
+
+ -
+
+
+ Save all
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Close
+
+
+
+
+
+
+
+
+
+
+
+ TreeView
+ QTreeView
+
+
+
+
+
+
+
+
+ closeBtn
+ clicked()
+ ManifestDialog
+ accept()
+
+
+ 319
+ 272
+
+
+ 199
+ 149
+
+
+
+
+
============================================================
--- guitone/src/view/dialogs/RevisionManifest.cpp 5a224c000a43c839dbd6294a438ba6afdec2b542
+++ guitone/src/view/dialogs/RevisionManifest.cpp 5a224c000a43c839dbd6294a438ba6afdec2b542
@@ -0,0 +1,153 @@
+/***************************************************************************
+ * Copyright (C) 2007 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 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 "RevisionManifest.h"
+#include "Monotone.h"
+#include "OpenFile.h"
+
+#include
+#include
+#include
+
+RevisionManifest::RevisionManifest(QWidget* parent, QString rev)
+ : Dialog(parent), revision(rev)
+{
+ setupUi(this);
+ Dialog::init();
+
+ setWindowTitle(windowTitle().arg(revision));
+
+ manifestModel = new Manifest(this);
+ manifestView->setModel(manifestModel);
+
+ connect(
+ saveSelected, SIGNAL(clicked()),
+ this, SLOT(saveSelectedFiles())
+ );
+
+ connect(
+ saveAll, SIGNAL(clicked()),
+ this, SLOT(saveAllFiles())
+ );
+
+ connect(
+ manifestView, SIGNAL(doubleClicked(const QModelIndex &)),
+ this, SLOT(openFile(const QModelIndex &))
+ );
+
+ if (!manifestModel->readManifest(revision))
+ {
+ qCritical("RevisionManifest: couldn't execute readManifest");
+ // FIXME: proper error handling here
+ }
+}
+
+RevisionManifest::~RevisionManifest()
+{
+ delete manifestModel;
+}
+
+void RevisionManifest::saveAllFiles()
+{
+ qDebug("TODO: query all file names");
+}
+
+void RevisionManifest::saveSelectedFiles()
+{
+ QModelIndexList indexes = manifestView->selectionModel()->selectedIndexes();
+ if (indexes.size() == 0)
+ {
+ qDebug("RevisionManifest::saveSelectedFiles: no files selected");
+ return;
+ }
+
+ ManifestEntry * entry;
+ for (int i=0, j=indexes.size(); i(indexes.at(i).internalPointer());
+ qDebug(qPrintable(entry->path));
+ }
+}
+
+void RevisionManifest::openFile(const QModelIndex & index)
+{
+ if (!index.isValid()) return;
+
+ ManifestEntry * entry = static_cast(index.internalPointer());
+
+ if (entry->is_directory)
+ {
+ QMessageBox::information(
+ this,
+ tr("Information"),
+ tr("You can't open directories which are not checked out.")
+ );
+ return;
+ }
+
+ Monotone * mtn = Monotone::singleton();
+ QStringList cmd;
+ cmd << "get_file" << entry->hash;
+
+ int retCode;
+ if (!mtn->executeCommand(cmd, retCode))
+ {
+ qCritical("RevisionManifest::openFile: cannot execute get_file (return code %d)", retCode);
+ return;
+ }
+
+ QString tempFile = QDir::tempPath();
+ tempFile.append(QDir::separator()).append(entry->filename());
+
+ QFile file(tempFile);
+ if (!file.open(QIODevice::WriteOnly))
+ {
+ qCritical("RevisionManifest::openFile: can't open temporary file for writing");
+ return;
+ }
+ // FIXME: we must write the original QByteArray here instead of messing
+ // around with strings, but for this the Monotone wrapper has - once again -
+ // to be rewritten first...
+ file.write(mtn->getDataAndReset().toUtf8());
+ file.close();
+
+ if (!OpenFile::open(this, tempFile))
+ {
+ QMessageBox::critical(
+ this,
+ tr("Error"),
+ tr("Unable to open files on your platform - please contact the "
+ "author about this problem.")
+ );
+
+ file.remove();
+ return;
+ }
+
+ QMessageBox::information(
+ this,
+ tr("Information"),
+ tr("Please close this message to remove the temporary file.")
+ );
+
+ file.remove();
+}
+
============================================================
--- guitone/src/view/dialogs/RevisionManifest.h 5c1fb28b9275b8bd7c49500f3116f7e5ceff1921
+++ guitone/src/view/dialogs/RevisionManifest.h 5c1fb28b9275b8bd7c49500f3116f7e5ceff1921
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * Copyright (C) 2007 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 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 REVISION_MANIFEST_H
+#define REVISION_MANIFEST_H
+
+#include "Dialog.h"
+#include "ui_manifest.h"
+#include "Manifest.h"
+
+class RevisionManifest : public Dialog, private Ui::ManifestDialog
+{
+ Q_OBJECT
+
+public:
+ RevisionManifest(QWidget *, QString);
+ ~RevisionManifest();
+
+private:
+ Manifest * manifestModel;
+ QString revision;
+
+private slots:
+ void saveSelectedFiles();
+ void saveAllFiles();
+ void openFile(const QModelIndex &);
+};
+
+#endif
============================================================
--- guitone/guitone.pro fa6591e3761c27f496f59500e56dfa6cf9fcfbce
+++ guitone/guitone.pro 3e702820638e27442e7f8faee1acaad663c97f1b
@@ -28,6 +28,7 @@ HEADERS += src/view/MainWindow.h \
src/view/dialogs/GenerateKeypair.h \
src/view/dialogs/About.h \
src/view/dialogs/DatabaseView.h \
+ src/view/dialogs/RevisionManifest.h \
src/monotone/Monotone.h \
src/model/MonotoneDelegate.h \
src/model/Inventory.h \
@@ -70,6 +71,7 @@ SOURCES += src/view/MainWindow.cpp \
src/view/dialogs/GenerateKeypair.cpp \
src/view/dialogs/About.cpp \
src/view/dialogs/DatabaseView.cpp \
+ src/view/dialogs/RevisionManifest.cpp \
src/monotone/Monotone.cpp \
src/model/MonotoneDelegate.cpp \
src/model/Inventory.cpp \
@@ -106,7 +108,8 @@ FORMS += res/forms/switch_workspace.ui
res/forms/generate_keypair.ui \
res/forms/about.ui \
res/forms/main_window.ui \
- res/forms/databaseview.ui
+ res/forms/databaseview.ui \
+ res/forms/manifest.ui
UI_DIR = tmp
OBJECTS_DIR = tmp
============================================================
--- guitone/res/i18n/guitone_de.ts cf253683411fe5f117013753b5e2c7d77c1f0310
+++ guitone/res/i18n/guitone_de.ts 5929ed1a92db7f99aea94ecff0b1466f0fe56875
@@ -75,52 +75,52 @@
Certs
-
+
ok
OK
-
+
bad
schlecht
-
+
unknown
unbekannt
-
+
trusted
vertrauenswürdig
-
+
untrusted
nicht vertrauenswürdig
-
+
Key
Schlüssel
-
+
Name
Name
-
+
Value
Wert
-
+
Signature
Signatur
-
+
Trust
Vertrauen
@@ -900,6 +900,42 @@ Sie können zum Arbeitsbereich-Modus jed
+ Manifest
+
+
+ File
+ Datei
+
+
+
+ Hash
+
+
+
+
+ ManifestDialog
+
+
+ Files in %1
+
+
+
+
+ Save selected
+
+
+
+
+ Save all
+
+
+
+
+ Close
+ SchlieÃen
+
+
+
Monotone
@@ -1080,6 +1116,34 @@ monotone gab zurück:
+ RevisionManifest
+
+
+ Error
+ Fehler
+
+
+
+ Unable to open files on your platform - please contact the author about this problem.
+ Kann keine Dateien auf Ihrer Plattform öffnen - bitte kontaktieren Sie den Autor über dieses Problem.
+
+
+
+ Please close this message to remove the temporary file.
+
+
+
+
+ Information
+
+
+
+
+ You can't open directories which are not checked out.
+
+
+
+
Select
@@ -1110,27 +1174,27 @@ monotone gab zurück:
Abbrechen
-
+
Branch
Zweig
-
+
Tag
Marke
-
+
Author
Autor
-
+
Date
Datum
-
+
Custom
Selbstdefiniert
@@ -1140,32 +1204,32 @@ monotone gab zurück:
beinhaltet
-
+
Revision
Revision
-
+
Invalid selection
Ungültige Auswahl
-
+
The given selection could not be processed: %1
Die eingegebene Auswahl kann nicht ausgeführt werden: %1
-
+
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?
@@ -1185,12 +1249,12 @@ monotone gab zurück:
Ãnderungen anzeigen
-
+
First: %1...
Erste: %1...
-
+
Second: %1...
Zweite: %1...
============================================================
--- guitone/src/model/Certs.cpp 782481459f320468c583c3cb0c2d94844035790c
+++ guitone/src/model/Certs.cpp 9f20b724cfd368645c3247179ddbb45e92b52d92
@@ -35,11 +35,8 @@ Certs::~Certs()
delete mtnDelegate;
}
-bool Certs::readCerts(const QModelIndex & index)
+bool Certs::readCerts(const QString & rev)
{
- qDebug("reading certs");
- QString rev(index.data().toString());
-
// clear current attributes list
certs->clear();
// reset the view
============================================================
--- guitone/src/model/Certs.h b198dabe787ab4c0389557b74cfe8b6123a6e35b
+++ guitone/src/model/Certs.h 17c33f34b4be6c0830c784574705dd74e42312ca
@@ -55,7 +55,7 @@ public slots:
int columnCount(const QModelIndex&) const;
public slots:
- bool readCerts(const QModelIndex &);
+ bool readCerts(const QString &);
signals:
void certsRead();
============================================================
--- guitone/src/model/Manifest.cpp 2f05aa8a463676daeba4d5a1be5d849cacd8b269
+++ guitone/src/model/Manifest.cpp ef81008777f2af1572bdb6d3e877f3dbbb0ff5d5
@@ -91,18 +91,21 @@ void Manifest::parseOutput()
mEntry->is_directory = false;
}
- if (j == 0 && mEntry != root)
+ if (entry.sym == "dir" || entry.sym == "file")
{
- int pos = mEntry->path.indexOf("/");
- QString basePath = "";
- if (pos > -1)
+ if (mEntry->path != "")
{
- basePath = mEntry->path.left(pos);
+ int pos = mEntry->path.lastIndexOf("/");
+ QString basePath = "";
+ if (pos > -1)
+ {
+ basePath = mEntry->path.left(pos);
+ }
+ Q_ASSERT(directoryMap.contains(basePath));
+ ManifestEntry * parent = directoryMap.value(basePath);
+ mEntry->parent = parent;
+ parent->children.append(mEntry);
}
- Q_ASSERT(directoryMap.contains(basePath));
- ManifestEntry * parent = directoryMap.value(basePath);
- mEntry->parent = parent;
- parent->children.append(mEntry);
continue;
}
@@ -124,10 +127,11 @@ void Manifest::parseOutput()
}
}
+ Q_ASSERT(root);
+
// reset any connected view(s)
reset();
- // signal that we've finished (whoever listens to that)
emit manifestRead();
}
@@ -183,8 +187,10 @@ int Manifest::rowCount(const QModelIndex
{
parentEntry = static_cast(parent.internalPointer());
}
-
- return parentEntry->children.size();
+
+ if (!parentEntry) return 0;
+
+ return parentEntry->children.size();
}
QModelIndex Manifest::index(int row, int column, const QModelIndex& parent) const
============================================================
--- guitone/src/model/Manifest.h e6d99d6259e723aa8aec62782c98db9d37d82f36
+++ guitone/src/model/Manifest.h cf2dee4ff7a56821e2305cb6c08f7520ffa15df5
@@ -41,7 +41,9 @@ struct ManifestEntry
inline QString filename()
{
- return path.right(path.size() - path.lastIndexOf("/"));
+ int last = path.lastIndexOf("/");
+ if (last == -1) return path;
+ return path.right(path.size() - last - 1);
}
inline int row()
{
============================================================
--- guitone/src/view/dialogs/SwitchWorkspaceRevision.cpp bb862eb7efcae41624d5af6a56493bf161600e46
+++ guitone/src/view/dialogs/SwitchWorkspaceRevision.cpp a622d1e2fedd078e3307ca233bdf1298554de5a6
@@ -21,6 +21,7 @@
#include "SwitchWorkspaceRevision.h"
#include "Settings.h"
#include "RevisionDiff.h"
+#include "RevisionManifest.h"
#include
#include
@@ -81,7 +82,7 @@ SwitchWorkspaceRevision::SwitchWorkspace
// display the certs of a selected revision on click
connect(
revisionList, SIGNAL(clicked(const QModelIndex &)),
- certsModel, SLOT(readCerts(const QModelIndex &))
+ this, SLOT(readCerts(const QModelIndex &))
);
connect(
@@ -89,6 +90,12 @@ SwitchWorkspaceRevision::SwitchWorkspace
this, SLOT(enableDiffButtons(const QModelIndex &))
);
+ // show the manifest on double-click
+ connect(
+ revisionList, SIGNAL(doubleClicked(const QModelIndex &)),
+ this, SLOT(openManifestDialog(const QModelIndex &))
+ );
+
// handle selector errors
connect(
selectorModel, SIGNAL(invalidSelection(QString)),
@@ -321,3 +328,25 @@ void SwitchWorkspaceRevision::showDiffDi
dlg.exec();
}
+void SwitchWorkspaceRevision::readCerts(const QModelIndex & index)
+{
+ if (!index.isValid()) return;
+
+ QString rev(index.data().toString());
+
+ if (!certsModel->readCerts(rev))
+ {
+ qCritical("SwitchWorkspaceRevision::readCerts: couldn't read certs for %s", qPrintable(rev));
+ }
+}
+
+void SwitchWorkspaceRevision::openManifestDialog(const QModelIndex & index)
+{
+ if (!index.isValid()) return;
+
+ QString rev(index.data().toString());
+
+ RevisionManifest dlg(this, rev);
+ dlg.exec();
+}
+
============================================================
--- guitone/src/view/dialogs/SwitchWorkspaceRevision.h a0b1232436cc001948b1a9d11de0e598305505b9
+++ guitone/src/view/dialogs/SwitchWorkspaceRevision.h 4bd70e9d2d2583e5919f07072d3d581506c6f0b0
@@ -63,6 +63,8 @@ private slots:
void setSecondRevision();
void enableDiffButtons(const QModelIndex &);
void showDiffDialog();
+ void readCerts(const QModelIndex &);
+ void openManifestDialog(const QModelIndex &);
};
#endif