[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/kcontrol/filetypes
From:       Waldo Bastian <bastian () kde ! org>
Date:       2003-09-17 13:17:16
[Download RAW message or body]

CVS commit by waba: 

Don't save mimetype in user's dir if it isn't really needed.


  M +56 -51    typeslistitem.cpp   1.39
  M +1 -0      typeslistitem.h   1.15


--- kdebase/kcontrol/filetypes/typeslistitem.cpp  #1.38:1.39
@@ -119,20 +119,6 @@ void TypesListItem::getServiceOffers( QS
 }
 
-bool TypesListItem::isDirty() const
+bool TypesListItem::isMimeTypeDirty() const
 {
-  if ( !m_bFullInit)
-  {
-    return false;
-  }
-
-  if ( m_bNewItem )
-  {
-    kdDebug() << "New item, need to save it" << endl;
-    return true;
-  }
-
-  if ( !isMeta() )
-  {
-
     if ((m_mimetype->name() != name()) &&
         (name() != "application/octet-stream"))
@@ -159,8 +145,26 @@ bool TypesListItem::isDirty() const
     }
 
-    // not used anywhere?
-//     KServiceTypeProfile::OfferList offerList =
-//       KServiceTypeProfile::offers(m_mimetype->name());
+  QVariant v = m_mimetype->property( "X-KDE-AutoEmbed" );
+  unsigned int oldAutoEmbed = v.isValid() ? (v.toBool() ? 0 : 1) : 2;
+  if ( oldAutoEmbed != m_autoEmbed )
+    return true;
+  return false;
+}
 
+bool TypesListItem::isDirty() const
+{
+  if ( !m_bFullInit)
+  {
+    return false;
+  }
+
+  if ( m_bNewItem )
+  {
+    kdDebug() << "New item, need to save it" << endl;
+    return true;
+  }
+
+  if ( !isMeta() )
+  {
     QStringList oldAppServices;
     QStringList oldEmbedServices;
@@ -179,12 +183,9 @@ bool TypesListItem::isDirty() const
       return true;
     }
-
-    QVariant v = m_mimetype->property( "X-KDE-AutoEmbed" );
-    unsigned int oldAutoEmbed = v.isValid() ? (v.toBool() ? 0 : 1) : 2;
-    if ( oldAutoEmbed != m_autoEmbed )
+    if (isMimeTypeDirty())
       return true;
-
-  } else {
-
+  }
+  else
+  {
     KConfig config("konquerorrc", true);
     config.setGroup("EmbedSettings");
@@ -209,4 +210,7 @@ void TypesListItem::sync()
     return;
   }
+
+  if (isMimeTypeDirty())
+  {
   QString loc = m_mimetype->desktopEntryPath();
   loc = locateLocal("mime", loc);
@@ -228,4 +232,5 @@ void TypesListItem::sync()
 
   m_bNewItem = false;
+  }
 
   KConfig profile("profilerc", false, false);

--- kdebase/kcontrol/filetypes/typeslistitem.h  #1.14:1.15
@@ -54,4 +54,5 @@ public:
   const KMimeType::Ptr& mimeType() const { return m_mimetype; }
 
+  bool isMimeTypeDirty() const; // whether the mimetype .desktop file needs saving
   bool isDirty() const;
   void sync();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic