# # # patch "guitone/res/i18n/guitone_de.ts" # from [5f7e9b9b288e6e1455c3f41b858c05ef82f54c40] # to [3dfb593e7bf0a3b023a4aaf32f65a59fb7a03ecb] # # patch "guitone/src/view/InventoryView.cpp" # from [2fef05e0c9c4939fc5ea8a83a0b1c4a646afece5] # to [dc7b20564cdc3bd26e1dd4f498729f15198509f1] # # patch "guitone/src/view/InventoryView.h" # from [0fa7c01c0eba891531c4a7aced4c45a8801c4729] # to [7ce754d4fede57bc2df067eb97fb41547ecdbf70] # # patch "guitone/src/view/TreeView.cpp" # from [8d1f525057314f34770c5626da5e8053f435b52e] # to [5b4f86399682825dd48a24084136979464fd5c69] # # patch "guitone/src/view/TreeView.h" # from [60df98e1a6b69f77ea3738f40efecc2fc1dd0cb1] # to [7e93a8ff3028e2c65d1eee3114d92e3049d42ff5] # ============================================================ --- guitone/res/i18n/guitone_de.ts 5f7e9b9b288e6e1455c3f41b858c05ef82f54c40 +++ guitone/res/i18n/guitone_de.ts 3dfb593e7bf0a3b023a4aaf32f65a59fb7a03ecb @@ -353,127 +353,127 @@ InventoryView - + &Add &Hinzufügen - + Add to workspace Zum Arbeitsbereich hinzufügen - + &Remove En&tfernen - + Remove from workspace Vom Arbeitsbereich entfernen - + &Commit &Einpflegen - + Commit Einpflegen - + I&gnore Datei &ignorieren - + Ignore file Datei ignorieren - + &Unignore Datei nicht ign&orieren - + Unignore file Datei nicht mehr ignorieren - + R&evert &Zurücksetzen - + Revert uncommitted changes Nicht eingepflegte Änderungen verwerfen - + Rena&me Um&benennen - + Rename file Datei umbenennen - + D&iff U&nterschiede anzeigen - + Diff against base revision Unterschiede im Vergleich zur Basisrevision anzeigen - + &Go into &Wechseln zu - + Go into the directory Wechsle in das Verzeichnis - + &Open &Öffnen - + Open in default program In Standardprogramm öffnen - + Error Fehler - + The file you're trying to open does not exist. Die Datei, die Sie versucht haben zu öffnen, existiert nicht. - + 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. - + D&iff all Alle U&nterschiede anzeigen - + Show all differences Zeigt Unterschiede in allen Dateien ============================================================ --- guitone/src/view/InventoryView.cpp 2fef05e0c9c4939fc5ea8a83a0b1c4a646afece5 +++ guitone/src/view/InventoryView.cpp dc7b20564cdc3bd26e1dd4f498729f15198509f1 @@ -27,7 +27,6 @@ #include "RevisionDiff.h" #include -#include #include #include #include @@ -50,6 +49,11 @@ InventoryView::InventoryView(QWidget* pa this, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(itemClicked(const QModelIndex &)) ); + + connect( + this, SIGNAL(contextMenuRequested(const QModelIndexList &, const QPoint &)), + this, SLOT(slotContextMenuRequested(const QModelIndexList &, const QPoint &)) + ); } void InventoryView::setType(Type t) @@ -95,24 +99,8 @@ void InventoryView::setModel(QSortFilter // adds elements to the popup menu based on the selected items // since not all actions may apply on all items -void InventoryView::contextMenuEvent(QContextMenuEvent* ev) +void InventoryView::slotContextMenuRequested(const QModelIndexList & indexList, const QPoint & pos) { - QItemSelectionModel* selection = selectionModel(); - - // - // make sure the element under the cursor is selected as well - // TODO: it seems as sometimes the selection is screwed up for - // no particular reason... why? - // - QModelIndex index = indexAt(ev->pos()); - selection->select(index, - QItemSelectionModel::Select | - QItemSelectionModel::Current - ); - setSelectionModel(selection); - - QList indexList = selection->selectedIndexes(); - qDebug("Selected indexes: %d", indexList.size()); if (indexList.size() == 1) @@ -198,7 +186,7 @@ void InventoryView::contextMenuEvent(QCo // TODO: special items for directories to add/remove/commit/revert // items in subdirectories via getStatusRecursive and friends - menu.exec(mapToGlobal(ev->pos())); + menu.exec(pos); } else { ============================================================ --- guitone/src/view/InventoryView.h 0fa7c01c0eba891531c4a7aced4c45a8801c4729 +++ guitone/src/view/InventoryView.h 7ce754d4fede57bc2df067eb97fb41547ecdbf70 @@ -37,8 +37,7 @@ public: InventoryView(QWidget*); ~InventoryView(); - void contextMenuEvent(QContextMenuEvent *); - void setModel(QSortFilterProxyModel *); + void setModel(QSortFilterProxyModel *); void setType(Type); signals: @@ -67,6 +66,7 @@ private slots: private slots: void changeDirectory(const QModelIndex &); void itemClicked(const QModelIndex & index); + void slotContextMenuRequested(const QModelIndexList &, const QPoint &); void slotChdir(void); void slotOpen(void); ============================================================ --- guitone/src/view/TreeView.cpp 8d1f525057314f34770c5626da5e8053f435b52e +++ guitone/src/view/TreeView.cpp 5b4f86399682825dd48a24084136979464fd5c69 @@ -61,3 +61,30 @@ void TreeView::saveHeaderViewState() Settings::saveHeaderViewState(header(), QString(objectName()).append("_header")); } +void TreeView::contextMenuEvent(QContextMenuEvent* ev) +{ + QItemSelectionModel* selection = selectionModel(); + + // make sure the element under the cursor is selected as well + QModelIndex currentItem = indexAt(ev->pos()); + selection->select(currentItem, + QItemSelectionModel::Select | + QItemSelectionModel::Rows + ); + setSelectionModel(selection); + + // remove multiple cols of the same column, since we're selected + // complete rows we're not interested in these + QModelIndexList currentSelection = selection->selectedIndexes(); + for (int i=0; i < currentSelection.size(); i++) + { + if (currentSelection.at(i).column() > 0) + { + currentSelection.removeAt(i); + i--; + } + } + + emit contextMenuRequested(currentSelection, mapToGlobal(ev->pos())); +} + ============================================================ --- guitone/src/view/TreeView.h 60df98e1a6b69f77ea3738f40efecc2fc1dd0cb1 +++ guitone/src/view/TreeView.h 7e93a8ff3028e2c65d1eee3114d92e3049d42ff5 @@ -22,6 +22,7 @@ #define TREE_VIEW_H #include +#include class TreeView : public QTreeView { @@ -34,9 +35,13 @@ public: virtual void setModel(QAbstractItemModel*); void init(); +signals: + void contextMenuRequested(const QModelIndexList &, const QPoint &); + private: void saveHeaderViewState(); bool stateLoaded; + void contextMenuEvent(QContextMenuEvent *); }; #endif