Bug 112011

Summary: Allow to remove a local theme
Product: superkaramba Reporter: M. Ignacio Monge Garc <ignaciomonge>
Component: generalAssignee: Ryan Nickell <p0z3r>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description M. Ignacio Monge Garc 2005-09-04 02:15:29 UTC
Version:           SVN version (using KDE 3.4.90 (alpha1, >= 20050806), compiled sources)
Compiler:          gcc version 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8)
OS:                Linux (i686) release 2.6.13-ck1

At this moment, SK just can delete a theme downladed by "get new stuff" way, but hand-added themes only can be delete editing superkarambarc.
So, Superkaramba should delete not only downloaded themes but also local themes.
Comment 1 Ryan Nickell 2005-12-14 06:25:12 UTC
A good idea on how to handle this was presented here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1318668&group_id=21351&atid=371889

It may be possible, but we'll have to see if this isn't too feature ridden to add before 3.5.1.
Comment 2 Ryan Nickell 2005-12-22 16:33:20 UTC
SVN commit 490638 by nickell:

BUG:112011  Local themes can now be removed from the theme dialog, although we don't delete the theme out from underneath the user.  It is delisted so that they can change their mind later and run it again.

 M  +0 -2      themefile.cpp  
 M  +26 -16    themesdlg.cpp  


--- branches/KDE/3.5/kdeutils/superkaramba/src/themefile.cpp #490637:490638
@@ -327,8 +327,6 @@
 
 bool ThemeFile::canUninstall() const
 {
-  if(!isZipTheme())
-    return false;
   QFileInfo fi(file());
   if(fi.permission(QFileInfo::WriteUser) ||
      fi.permission(QFileInfo::WriteGroup) ||
--- branches/KDE/3.5/kdeutils/superkaramba/src/themesdlg.cpp #490637:490638
@@ -358,25 +358,35 @@
   KURL trash("trash:/");
   KURL theme(tf->file());
 
-  karambaApp->dcopIface()->closeTheme(tf->name());
-  if(!KProtocolInfo::isKnownProtocol(trash))
-    trash = KGlobalSettings::trashPath();
-  KIO::move(theme, trash);
-  tableThemes->removeItem(w);
+  if(!tf->isZipTheme())
+  {
+    kdDebug() << "removing " << tf->name() << " from the theme dialog" << endl;
+    karambaApp->dcopIface()->closeTheme(tf->name());
+    tableThemes->removeItem(w);
+  }
+  else
+  {
+    karambaApp->dcopIface()->closeTheme(tf->name());
+    if(!KProtocolInfo::isKnownProtocol(trash))
+      trash = KGlobalSettings::trashPath();
+    kdDebug() << "moving " << theme.fileName() << " to the trash" << endl;
+    KIO::move(theme, trash);
+    tableThemes->removeItem(w);
 #ifdef HAVE_KNEWSTUFF
-  // Remove theme from KNewStuffStatus
-  KConfig* config = KGlobal::config();
+    // Remove theme from KNewStuffStatus
+    KConfig* config = KGlobal::config();
 
-  config->setGroup("KNewStuffNames");
-  QString name = config->readEntry(theme.path());
-  kdDebug() << theme.path() << name << endl;
-  if(!name.isEmpty())
-  {
-    kapp->config()->deleteEntry(theme.path());
-    config->setGroup("KNewStuffStatus");
-    kapp->config()->deleteEntry(name);
+    config->setGroup("KNewStuffNames");
+    QString name = config->readEntry(theme.path());
+    kdDebug() << theme.path() << name << endl;
+    if(!name.isEmpty())
+    {
+      kapp->config()->deleteEntry(theme.path());
+      config->setGroup("KNewStuffStatus");
+      kapp->config()->deleteEntry(name);
+    }
+#endif
   }
-#endif
   selectionChanged(tableThemes->selected());
 }