Bug 135442

Summary: Add 'rename' entry to album RMB menu
Product: [Applications] digikam Reporter: Dik Takken <kde>
Component: Usability-MenusAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: 0.9.0   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 0.9.0
Sentry Crash Report:

Description Dik Takken 2006-10-11 10:35:37 UTC
Version:           0.9.0-beta1 (using KDE KDE 3.5.4)
Installed from:    Gentoo Packages
OS:                Linux

Almost any directory-like object in KDE has a 'rename' entry in its RMB menu. In the DigiKam collection browser, this is not the case. it is hidden one level deeper in album properties.

Please add a 'rename' entry, for the sake of consistency.
Comment 1 caulier.gilles 2006-12-12 14:32:41 UTC
Dik,

Are you talking about to add "Rename option" to Album RMB menu ?

Gilles Caulier
Comment 2 caulier.gilles 2006-12-12 15:04:11 UTC
SVN commit 612743 by cgilles:

digiKam from trunk : Added missing "Rename..." option on Album RMB menu.
BUG: 135442

 M  +55 -0     albumfolderview.cpp  
 M  +2 -0      albumfolderview.h  


--- trunk/extragear/graphics/digikam/digikam/albumfolderview.cpp #612742:612743
@@ -40,6 +40,13 @@
 #include <kaction.h>
 #include <kfiledialog.h>
 
+#include <kdeversion.h>
+#if KDE_IS_VERSION(3,2,0)
+#include <kinputdialog.h>
+#else
+#include <klineeditdlg.h>
+#endif
+
 // Local includes.
 
 #include "ddebug.h"
@@ -431,6 +438,7 @@
     // Root folder only shows "New Album..."
     if(item && item->parent())
     {
+        popmenu.insertItem(SmallIcon("pencil"), i18n("Rename..."), 14);
         popmenu.insertItem(SmallIcon("albumfoldercomment"), i18n("Edit Album Properties..."), 11);
         popmenu.insertItem(SmallIcon("reload_page"), i18n("Reset Album Icon"), 13);
         popmenu.insertSeparator();
@@ -528,6 +536,11 @@
             AlbumManager::instance()->updatePAlbumIcon(item->getAlbum(), 0, err);
             break;
         }
+        case 14:
+        {
+            albumRename(item);
+            break;
+        }
         default:
             break;
     }
@@ -678,6 +691,48 @@
         job->showErrorDialog(this);
 }
 
+void AlbumFolderView::albumRename()
+{
+    AlbumFolderViewItem *item = dynamic_cast<AlbumFolderViewItem*>(selectedItem());
+    if(!item)
+        return;
+
+    albumRename(item);
+}
+
+void AlbumFolderView::albumRename(AlbumFolderViewItem* item)
+{
+    PAlbum *album = item->getAlbum();
+
+    if (!album)
+        return;
+
+    QString oldTitle(album->title());
+    bool    ok;
+
+#if KDE_IS_VERSION(3,2,0)
+    QString title = KInputDialog::getText(i18n("Rename Album (%1)").arg(oldTitle), 
+                                          i18n("Enter new album name:"),
+                                          oldTitle, &ok, this);
+#else
+    QString title = KLineEditDlg::getText(i18n("Rename Item (%1)").arg(oldTitle), 
+                                          i18n("Enter new album name:"),
+                                          oldTitle, &ok, this);
+#endif
+
+    if (!ok)
+        return;
+
+    if(title != oldTitle)
+    {
+        QString errMsg;
+        if (!d->albumMan->renamePAlbum(album, title, errMsg))
+            KMessageBox::error(0, errMsg);
+    }
+
+    emit signalAlbumModified();
+}
+
 void AlbumFolderView::albumEdit()
 {
     AlbumFolderViewItem *item = dynamic_cast<AlbumFolderViewItem*>(selectedItem());
--- trunk/extragear/graphics/digikam/digikam/albumfolderview.h #612742:612743
@@ -58,6 +58,7 @@
     void albumNew();
     void albumDelete();
     void albumEdit();
+    void albumRename();
 
     void setAlbumThumbnail(PAlbum *album);
 
@@ -93,6 +94,7 @@
 
     void albumNew(AlbumFolderViewItem *item);
     void albumEdit(AlbumFolderViewItem *item);
+    void albumRename(AlbumFolderViewItem *item);
     void albumDelete(AlbumFolderViewItem *item);
 
     void addAlbumChildrenToList(KURL::List &list, Album *album);
Comment 3 Dik Takken 2006-12-12 22:37:25 UTC
Wow. thanks a lot!