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

List:       kde-commits
Subject:    KDE/kdeutils/ark/kerfuffle
From:       Raphael Kubo da Costa <kubito () gmail ! com>
Date:       2009-07-24 1:24:27
Message-ID: 1248398667.890530.16390.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1001726 by rkcosta:

Apidox++, use getters whenever possible

 M  +23 -12    batchextract.cpp  
 M  +39 -0     batchextract.h  


--- trunk/KDE/kdeutils/ark/kerfuffle/batchextract.cpp #1001725:1001726
@@ -119,19 +119,19 @@
         return;
     }
 
-    if (!m_subfolder.isEmpty()) {
-        kDebug() << "Creating subfolder" << m_subfolder;
-        QDir dest(m_destinationFolder);
-        dest.mkpath(m_subfolder);
-        m_destinationFolder += '/' + m_subfolder;
+    if (!subfolder().isEmpty()) {
+        kDebug() << "Creating subfolder" << subfolder();
+        QDir dest(destinationFolder());
+        dest.mkpath(subfolder());
+        m_destinationFolder += '/' + subfolder();
     }
 
     foreach(Kerfuffle::Archive *archive, m_inputs) {
         QString finalDestination;
-        if (m_destinationFolder.isEmpty()) {
+        if (destinationFolder().isEmpty()) {
             finalDestination = QDir::currentPath();
         } else {
-            finalDestination = m_destinationFolder;
+            finalDestination = destinationFolder();
         }
 
         addExtraction(archive, finalDestination);
@@ -221,8 +221,14 @@
     return m_preservePaths;
 }
 
+QString BatchExtract::destinationFolder()
+{
+    return m_destinationFolder;
+}
+
 void BatchExtract::setDestinationFolder(QString folder)
 {
+    // TODO: check whether the directory is valid
     if (!folder.isEmpty()) {
         m_destinationFolder = folder;
     }
@@ -233,6 +239,11 @@
     m_preservePaths = value;
 }
 
+QString BatchExtract::subfolder()
+{
+    return m_subfolder;
+}
+
 void BatchExtract::setSubfolder(QString subfolder)
 {
     m_subfolder = subfolder;
@@ -245,22 +256,22 @@
         dialog->batchModeOption();
     }
 
-    if (m_destinationFolder.isEmpty()) {
+    if (destinationFolder().isEmpty()) {
         dialog->setCurrentUrl(QDir::currentPath());
     } else {
-        dialog->setCurrentUrl(m_destinationFolder);
+        dialog->setCurrentUrl(destinationFolder());
     }
 
     dialog->setAutoSubfolder(autoSubfolder());
     dialog->setPreservePaths(preservePaths());
 
-    if (m_subfolder.isEmpty() && m_inputs.size() == 1) {
+    if (subfolder().isEmpty() && m_inputs.size() == 1) {
         if (m_inputs.at(0)->isSingleFolderArchive()) {
             dialog->setSingleFolderArchive(true);
         }
         dialog->setSubfolder(m_inputs.at(0)->subfolderName());
     } else {
-        dialog->setSubfolder(m_subfolder);
+        dialog->setSubfolder(subfolder());
     }
 
     if (!dialog->exec()) {
@@ -270,7 +281,7 @@
     setDestinationFolder(dialog->destinationDirectory().path());
 
     if (dialog->extractToSubfolder()) {
-        m_subfolder = dialog->subfolder();
+        setSubfolder(dialog()->subfolder());
     }
 
     setAutoSubfolder(dialog->autoSubfolders());
--- trunk/KDE/kdeutils/ark/kerfuffle/batchextract.h #1001725:1001726
@@ -113,8 +113,47 @@
      *                  plugin could not be found.
      */
     bool addInput(const KUrl& url);
+
+    /**
+     * Shows the extract options dialog before extracting the files.
+     *
+     * @return @c true  The user has set some options and clicked OK.
+     * @return @c false The user has canceled extraction.
+     */
     bool showExtractDialog();
+
+    /**
+     * Returns the destination directory where the archives
+     * will be extracted to.
+     *
+     * @return The destination directory.
+     */
+    QString destinationFolder();
+
+    /**
+     * Sets the directory the archives will be extracted to.
+     * If @c setSubfolder has been used, the final destination
+     * directory will be the concatenation of both.
+     *
+     * @param folder The directory that will be used.
+     */
     void setDestinationFolder(QString folder);
+
+    /**
+     * Returns the subdirectory into which the archives
+     * will be extracted, if it has been set.
+     *
+     * @return The subdirectory that will be used, or an
+     *         empty @c QString if none has been set.
+     */
+    QString subfolder();
+
+    /**
+     * Force the creation of a subdirectory inside the destination
+     * directory, so that the archives are extracted into it.
+     *
+     * @param subfolder The subdirectory that will be created.
+     */
     void setSubfolder(QString subfolder);
 
     /**
[prev in list] [next in list] [prev in thread] [next in thread] 

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