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

List:       kde-commits
Subject:    KDE/kdenetwork/kget
From:       Matthias Fuchs <mat69 () gmx ! net>
Date:       2011-02-08 20:36:54
Message-ID: 20110208203654.E039DAC8C2 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1219464 by mfuchs:

Adds a "Ask for destination if there are no default folders"-option

If deselected no dialogs will be shown asking the user for a destination, instead \
always a destination will be used. Unless KGlobalSettings::downloadPath() is not \
defined. BUG:130272

 M  +7 -0      conf/dlggroups.ui  
 M  +3 -0      conf/kget.kcfg  
 M  +27 -2     ui/newtransferdialog.cpp  


--- trunk/KDE/kdenetwork/kget/conf/dlggroups.ui #1219463:1219464
@@ -19,6 +19,13 @@
     </widget>
    </item>
    <item>
+    <widget class="QCheckBox" name="kcfg_AskForDestination">
+     <property name="text">
+      <string>Ask for destination if there are no default folders</string>
+     </property>
+    </widget>
+   </item>
+   <item>
     <widget class="TransfersGroupTree" name="treeView">
      <property name="alternatingRowColors">
       <bool>true</bool>
--- trunk/KDE/kdenetwork/kget/conf/kget.kcfg #1219463:1219464
@@ -168,6 +168,9 @@
     <entry name="DirectoriesAsSuggestion" type="Bool">
       <default>false</default>
     </entry>
+    <entry name="AskForDestination" type="Bool">
+        <default>true</default>
+    </entry>
   </group>
 
   <group name="Internal">
--- trunk/KDE/kdenetwork/kget/ui/newtransferdialog.cpp #1219463:1219464
@@ -649,7 +649,12 @@
         const KUrl sourceUrl = urls.first();
         const QList<TransferGroupHandler*> groups = \
                KGet::groupsFromExceptions(sourceUrl);
         const QString groupName = (groups.isEmpty() ? QString() : \
                groups.first()->name());
-        const QString defaultFolder = (groups.isEmpty() ? QString() : \
groups.first()->defaultFolder()); +        QString defaultFolder;
+        if (groups.isEmpty()) {
+            defaultFolder = (Settings::askForDestination() ? QString() : \
KGlobalSettings::downloadPath()); +        } else {
+            defaultFolder = groups.first()->defaultFolder();
+        }
 
         if (!folder.isEmpty()) {
             const KUrl destUrl = UrlChecker::destUrl(KUrl(folder), sourceUrl, \
suggestedFileName); @@ -658,7 +663,8 @@
                 data << KGet::TransferData(sourceUrl, newDest, groupName);
             }
             urls.removeFirst();
-        } else if (!Settings::directoriesAsSuggestion() && \
(UrlChecker::checkFolder(KUrl(defaultFolder)) == UrlChecker::NoError)) { +        } \
else if (((!groups.isEmpty() && !Settings::directoriesAsSuggestion()) || \
!Settings::askForDestination()) && +                   \
                (UrlChecker::checkFolder(KUrl(defaultFolder)) == \
                UrlChecker::NoError)) {
             const KUrl destUrl = UrlChecker::destUrl(KUrl(defaultFolder), sourceUrl, \
suggestedFileName);  newDest = check.checkExistingFile(sourceUrl, destUrl);
             if (!newDest.isEmpty()) {
@@ -748,6 +754,25 @@
         }
     }
 
+    ///Download the rest of the urls to KGlobalSettings::downloadPath() if the user \
is not aksed for a destination +    if (!Settings::askForDestination()) {
+        //the download path will be always used
+        const QString dir = KGlobalSettings::downloadPath();
+        if (!dir.isEmpty()) {
+            KUrl::List::iterator it = urls.begin();
+            while (it != urls.end()) {
+                const KUrl sourceUrl = *it;
+                const KUrl destUrl = UrlChecker::destUrl(dir, sourceUrl);
+                newDest = check.checkExistingFile(sourceUrl, destUrl);
+                if (!newDest.isEmpty()) {
+                    data << KGet::TransferData(sourceUrl, newDest);
+                }
+
+                it = urls.erase(it);
+            }
+        }
+    }
+
     ///Now create transfers for the urls that provided enough data
     if (!data.isEmpty()) {
         KGet::createTransfers(data);


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

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