# # # patch "guitone/src/model/Inventory.cpp" # from [0148aa9cddac6881602f0b5d9cac11b15e2a70a1] # to [0e2147b691371bee5edf59e5ab667646fca91c5f] # # patch "guitone/src/model/Inventory.h" # from [c2e138ad64013bad901b7070063e3b18548161bf] # to [89fdbc73a2dfef156339722e53ef3d8ca73e6819] # # patch "guitone/src/model/InventoryItem.cpp" # from [b178550182c241b2bf9255497b60f3ba8041ba26] # to [fe1309eebea7435b174d64b01fbe87f363d979fb] # # patch "guitone/src/model/InventoryItem.h" # from [7ca548cdb224d240876d5cb8654dc2b6548f5c20] # to [ccf79af033dde978761b38c6331274349121acad] # # patch "guitone/src/view/InventoryView.cpp" # from [a54de14edd4781734f92726cee3c21faad15004a] # to [9ab95e9d6627610fb2567709fb8a912e93eeb281] # ============================================================ --- guitone/src/model/Inventory.cpp 0148aa9cddac6881602f0b5d9cac11b15e2a70a1 +++ guitone/src/model/Inventory.cpp 0e2147b691371bee5edf59e5ab667646fca91c5f @@ -226,7 +226,7 @@ QVariant Inventory::data(const QModelInd InventoryItem * item = static_cast(index.internalPointer()); - if((role == Qt::DecorationRole) && (index.column() == 0)) + if ((role == Qt::DecorationRole) && (index.column() == 0)) { return iconProvider->getIcon(item); } @@ -238,17 +238,7 @@ bool Inventory::setData(const QModelInde bool Inventory::setData(const QModelIndex & idx, const QVariant & value, int role) { - Q_ASSERT(idx.column() == 0); - if (!idx.isValid()) return false; - - InventoryItem * item = static_cast(idx.internalPointer()); - if (!item || role != Qt::EditRole) return false; - - if (!item->rename(value.toString())) return false; - - emit layoutChanged(); - - return true; + return false; } bool Inventory::setItemData(const QModelIndex & index, const QMap & roles) @@ -266,13 +256,16 @@ Qt::ItemFlags Inventory::flags(const QMo if (item->isCdUp() || item->isRootDirectory()) return flags; + /* + // Disabled until we have figured out how to implement renaming properly flags |= Qt::ItemIsEditable | Qt::ItemIsDragEnabled; if (item->isDirectory()) { flags |= Qt::ItemIsDropEnabled; } - + */ + return flags; } @@ -317,18 +310,6 @@ int Inventory::rowCount(const QModelInde return parentItem->childCount(); } -bool Inventory::insertRows(int row, int count, const QModelIndex & parent) -{ - // FIXME: implement item adding - return false; -} - -bool Inventory::insertColumns(int column, int count, const QModelIndex & parent) -{ - // FIXME: implement item adding - return false; -} - bool Inventory::parseInventoryLine( const QString &inputString, int &status, ============================================================ --- guitone/src/model/Inventory.h c2e138ad64013bad901b7070063e3b18548161bf +++ guitone/src/model/Inventory.h 89fdbc73a2dfef156339722e53ef3d8ca73e6819 @@ -52,8 +52,6 @@ class Inventory : public QAbstractItemMo QModelIndex parent(const QModelIndex&) const; int rowCount(const QModelIndex&) const; int columnCount(const QModelIndex&) const; - bool insertRows(int, int, const QModelIndex & parent = QModelIndex()); - bool insertColumns(int, int, const QModelIndex & parent = QModelIndex()); private: void parseOutput(); ============================================================ --- guitone/src/model/InventoryItem.cpp b178550182c241b2bf9255497b60f3ba8041ba26 +++ guitone/src/model/InventoryItem.cpp fe1309eebea7435b174d64b01fbe87f363d979fb @@ -308,57 +308,3 @@ QString InventoryItem::getRenameInfo() c return strings.join(", "); } -bool InventoryItem::rename(const QString & n) -{ - QString newName(n.trimmed()); - if (newName.size() == 0) return false; - - // the file wasn't renamed - if (newName == getFilename()) return false; - - qDebug("InventoryItem::rename: renaming to %s", qPrintable(newName)); - - // TODO: do the actual rename here - - // check if this item is part of a uncommitted rename action already - if (hasStatus(InventoryItem::RenamedTo)) - { - setPath(getBaseDirectory() + newName); - qDebug("InventoryItem::rename: item already renamed, changing item's name"); - return true; - } - - if (hasStatus(InventoryItem::RenamedFrom)) - { - InventoryItem * renamedTo = getRenamedTo(); - renamedTo->setPath(getBaseDirectory() + newName); - qDebug("InventoryItem::rename: item already renamed, changing target item's name"); - return true; - } - - // apparently its not, lets create a new rename entry - InventoryItem * renamedItem = new InventoryItem(this); - parentItem->appendChild(renamedItem); - - renamedItem->setStatus(status | InventoryItem::RenamedTo); - setStatus(status | InventoryItem::RenamedFrom); - - renamedItem->setPath(getBaseDirectory() + newName); - - renamedItem->setRenamedFrom(this); - this->setRenamedTo(renamedItem); - - // remove any children from the renamed_from item, these entries - // are now part of the renamed_to item - // FIXME: this crashes, we probably need to do this directly in the model - /* - if (isDirectory()) - { - deleteAllChildren(); - } - */ - - qDebug("InventoryItem::rename: created new rename item"); - - return true; -} ============================================================ --- guitone/src/model/InventoryItem.h 7ca548cdb224d240876d5cb8654dc2b6548f5c20 +++ guitone/src/model/InventoryItem.h ccf79af033dde978761b38c6331274349121acad @@ -73,7 +73,6 @@ public: int row(void) const; void appendChild(InventoryItem*); QVariant data(int, int) const; - bool rename(const QString &); static const int RenamedFrom; static const int RenamedTo; ============================================================ --- guitone/src/view/InventoryView.cpp a54de14edd4781734f92726cee3c21faad15004a +++ guitone/src/view/InventoryView.cpp 9ab95e9d6627610fb2567709fb8a912e93eeb281 @@ -500,9 +500,7 @@ void InventoryView::slotRename(void) void InventoryView::slotRename(void) { - QModelIndex index(getSingleSelection(false)); - if (!index.isValid()) return; - edit(index); + qDebug("InventoryView::slotRename!!!"); } //