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

List:       kde-commits
Subject:    KDE/kdebase/apps/konqueror/src
From:       David Faure <faure () kde ! org>
Date:       2010-07-02 19:22:41
Message-ID: 20100702192241.DEB33AC8E2 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1145395 by dfaure:

Forwardport fix for bug 242186: make --profile work again, even when no url is given.


 M  +5 -14     konqmain.cpp  
 M  +16 -5     konqmisc.cpp  


--- trunk/KDE/kdebase/apps/konqueror/src/konqmain.cpp #1145394:1145395
@@ -162,8 +162,8 @@
         } else if (args->count() == 0) {
             // No args. If --silent, do nothing, otherwise create a default window.
             if (!args->isSet("silent")) {
-                const QString profile = KonqMisc::defaultProfileName();
-                KonqMisc::createBrowserWindowFromProfile(KonqMisc::defaultProfilePath(), \
profile); +                const QString profile = args->getOption("profile");
+                KonqMisc::createBrowserWindowFromProfile(QString(), profile);
             }
         } else {
             // Now is a good time to parse each argument as a URL.
@@ -201,18 +201,9 @@
 
             KonqMainWindow * mainwin = 0;            
             if (args->isSet("profile")) {
-                QString profile = args->getOption("profile");
-                QString profilePath = profile;
-                if (!profile.startsWith('/')) {
-                    profilePath = KStandardDirs::locate("data", \
                QLatin1String("konqueror/profiles/")+profile);
-                    if (profilePath.isEmpty()) {
-                        profile = KonqMisc::defaultProfileName();
-                        profilePath = KonqMisc::defaultProfilePath();
-                    }
-                }
-
-                kDebug() << "main() -> createBrowserWindowFromProfile mimeType=" << \
                urlargs.mimeType();
-                mainwin = KonqMisc::createBrowserWindowFromProfile(profilePath, \
profile, firstUrl, urlargs, KParts::BrowserArguments(), false /*forbidUseHTML*/, \
filesToSelect); +                const QString profile = args->getOption("profile");
+                //kDebug() << "main() -> createBrowserWindowFromProfile mimeType=" \
<< urlargs.mimeType(); +                mainwin = \
KonqMisc::createBrowserWindowFromProfile(QString(), profile, firstUrl, urlargs, \
KParts::BrowserArguments(), false /*forbidUseHTML*/, filesToSelect);  } else {
                 const bool tempFile = KCmdLineArgs::isTempFileSet();
                 mainwin = KonqMisc::createNewWindow(firstUrl, urlargs, \
                KParts::BrowserArguments(), false, filesToSelect, tempFile);
--- trunk/KDE/kdebase/apps/konqueror/src/konqmisc.cpp #1145394:1145395
@@ -17,6 +17,7 @@
    Boston, MA 02110-1301, USA.
 */
 #include "konqmisc.h"
+#include <QDir>
 #include "konqsessionmanager.h"
 #include "konqsettingsxt.h"
 #include "konqmainwindow.h"
@@ -97,18 +98,28 @@
 					forbidUseHTML, filesToSelect, tempFile, openUrl, show );
 }
 
-KonqMainWindow * KonqMisc::createBrowserWindowFromProfile( const QString& _path, \
const QString &filename, const KUrl &url, +KonqMainWindow * \
KonqMisc::createBrowserWindowFromProfile( const QString& _path, const QString \
                &_filename, const KUrl &url,
                                                            const \
                KParts::OpenUrlArguments &args,
                                                            const \
                KParts::BrowserArguments& browserArgs,
                                                            bool forbidUseHTML, const \
                QStringList& filesToSelect,
                                                            bool tempFile, bool \
openUrl, bool show )  {
     QString path(_path);
-    kDebug() << "path=" << path << ", filename=" << filename << ", url=" << url;
-    Q_ASSERT(!path.isEmpty());
-    // Well the path can be empty when misusing DBUS calls....
-    if (path.isEmpty())
+    QString filename(_filename);
+    if (path.isEmpty()) { // no path given, determine it from the filename
+        if (filename.isEmpty()) {
+            filename = defaultProfileName();
+        }
+        if (QDir::isRelativePath(filename)) {
+            path = KStandardDirs::locate("data", \
QLatin1String("konqueror/profiles/")+filename); +            if (path.isEmpty()) { // \
not found +                filename = defaultProfileName();
         path = defaultProfilePath();
+            }
+        } else {
+            path = filename; // absolute path
+        }
+    }
 
   abortFullScreenMode();
 


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

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