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

List:       kde-commits
Subject:    kdelibs/kdecore
From:       Waldo Bastian <bastian () kde ! org>
Date:       2003-09-08 11:51:53
[Download RAW message or body]

CVS commit by waba: 

* Make it possible to copy KDesktopFile (BIC)
* Now that working directories in .desktop files are actually supported
readPath no longer needs to be deprecated.


  M +4 -3      kconfig.cpp   1.74
  M +5 -3      kconfig.h   1.59
  M +10 -1     kdesktopfile.cpp   1.43
  M +14 -4     kdesktopfile.h   1.35


--- kdelibs/kdecore/kconfig.h  #1.58:1.59
@@ -159,6 +159,8 @@ public:
    *
    * @param file the new config object will save itself to.
+   * @param config optional config object to reuse
+   * @since 3.2
    */
-  KConfig* copyTo(const QString &file);
+  KConfig* copyTo(const QString &file, KConfig *config=0);
 
 protected:

--- kdelibs/kdecore/kconfig.cpp  #1.73:1.74
@@ -287,7 +287,8 @@ void KConfig::checkUpdate(const QString 
 }
 
-KConfig* KConfig::copyTo(const QString &file)
+KConfig* KConfig::copyTo(const QString &file, KConfig *config)
 {
-  KConfig *config = new KConfig(QString::null, false, false);
+  if (!config)
+     config = new KConfig(QString::null, false, false);
   config->backEnd->changeFileName(file, "config", false);
   config->setReadOnly(false);

--- kdelibs/kdecore/kdesktopfile.cpp  #1.42:1.43
@@ -319,2 +319,11 @@ QString KDesktopFile::readDocPath() cons
 }
 
+KDesktopFile* KDesktopFile::copyTo(const QString &file)
+{
+  KDesktopFile *config = new KDesktopFile(QString::null, false);
+  KConfig::copyTo(file, config);
+  config->setDesktopGroup();
+  return config;
+}
+
+

--- kdelibs/kdecore/kdesktopfile.h  #1.34:1.35
@@ -124,7 +124,6 @@ public:
    * Returns the value of the "Path=" entry.
    * @return the path or QString::null if not specified
-   * @deprecated
    */
-  QString readPath() const KDE_DEPRECATED;
+  QString readPath() const;
 
   /**
@@ -217,4 +216,15 @@ public:
   QStringList sortOrder() const;
 
+  /**
+   * Copies all entries from this config object to a new 
+   * KDesktopFile object that will save itself to @p file.
+   *
+   * Actual saving to @p file happens when the returned object is
+   * destructed or when sync() is called upon it.
+   *
+   * @param file the new KDesktopFile object it will save itself to.
+   * @since 3.2
+   */
+  KDesktopFile* copyTo(const QString &file);
 
 #ifdef KDE_NO_COMPAT


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

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