List Info

Thread: KDE/kdebase/apps/konqueror




KDE/kdebase/apps/konqueror
user name
2008-04-27 17:38:02
SVN commit 801854 by dfaure:

GUI: Make "Home URL" setting in konqueror
mode-dependent (one for the webbrowser in konquerorrc and
one for the filemanager in kfmrc) instead of the overkill
one-setting-per-profile half-finished solution.


 M  +39 -26    settings/konqhtml/generalopts.cpp  
 M  +3 -0      settings/konqhtml/generalopts.h  
 M  +1 -4      src/konqmainwindow.cpp  
 M  +25 -3     src/konqmisc.cpp  
 M  +5 -0      src/konqmisc.h  
 M  +0 -6      src/konqsettings.cpp  
 M  +2 -4      src/konqsettings.h  
 M  +8 -6      src/konqueror.kcfg  
 M  +2 -2      src/konqviewmanager.cpp  
 M  +0 -3      src/konqviewmanager.h  


---
trunk/KDE/kdebase/apps/konqueror/settings/konqhtml/generalop
ts.cpp #801853:801854
 -31,6
+31,9 
 
 K_PLUGIN_FACTORY_DECLARATION(KcmKonqHtmlFactory)
 
+// Keep in sync with konqueror.kcfg - TODO use it here
+static const char* DEFAULT_HOMEPAGE = "http://www.kde.org";
+
 //---------------------------------------------------------
--------------------
 
 KKonqGeneralOptions::KKonqGeneralOptions(QWidget *parent,
const QVariantList&)
 -41,28
+44,8 
     lay->setMargin(0);
     lay->setSpacing(KDialog::spacingHint());
 
-    //HOME URL
-    QHBoxLayout *homeLayout = new QHBoxLayout;
+    addHomeUrlWidgets(lay);
 
-    QLabel *label = new QLabel(i18n("Home
&URL:"), this);
-    homeLayout->addWidget(label);
-
-    homeURL = new KUrlRequester(this);
-    homeURL->setMode(KFile:irectory
);
-    homeURL->setWindowTitle(i18n("Select Home
Folder"));
-    homeLayout->addWidget(homeURL);
-    connect(homeURL, SIGNAL(textChanged(const QString
&)), SLOT(slotChanged()));
-    label->setBuddy(homeURL);
-
-    lay->addLayout(homeLayout);
-
-    QString homestr = i18n("This is the URL (e.g. a
folder or a web page) where "
-                           "Konqueror will jump to
when the "Home" button is pressed. "
-                           "This is usually your home
folder, symbolized by a 'tilde' (~).");
-    label->setWhatsThis(homestr);
-    homeURL->setWhatsThis(homestr);
-    //HOME URL
-
     QGroupBox* tabsGroup = new QGroupBox(i18n("Tabbed
Browsing"));
 
     tabOptions = new Ui_advancedTabOptions;
 -85,6
+68,31 
     emit changed(false);
 }
 
+void KKonqGeneralOptions::addHomeUrlWidgets(QVBoxLayout*
lay)
+{
+    QHBoxLayout *homeLayout = new QHBoxLayout;
+
+    QLabel *label = new QLabel(i18n("Home
Page:"), this);
+    homeLayout->addWidget(label);
+
+    homeURL = new KUrlRequester(this);
+    homeURL->setMode(KFile:irectory
);
+    homeURL->setWindowTitle(i18n("Select Home
Page"));
+    homeLayout->addWidget(homeURL);
+    connect(homeURL, SIGNAL(textChanged(QString)),
SLOT(slotChanged()));
+    label->setBuddy(homeURL);
+
+    lay->addLayout(homeLayout);
+
+    QString homestr = i18n("This is the URL of the web
page where "
+                           "Konqueror (as web browser)
will jump to when "
+                           "the "Home"
button is pressed. When Konqueror is "
+                           "started as a file manager,
that button makes it jump "
+                           "to your local home folder
instead.");
+    label->setWhatsThis(homestr);
+    homeURL->setWhatsThis(homestr);
+}
+
 KKonqGeneralOptions::~KKonqGeneralOptions()
 {
     delete tabOptions;
 -92,9
+100,12 
 
 void KKonqGeneralOptions::load()
 {
-    KConfigGroup cg(m_pConfig, "FMSettings");
-    
-    homeURL->setUrl(cg.readEntry("HomeURL",
"~"));
+    KConfigGroup userSettings(m_pConfig,
"UserSettings");
+   
homeURL->setUrl(userSettings.readEntry("HomeURL"
;, DEFAULT_HOMEPAGE));
+
+
+    KConfigGroup cg(m_pConfig, "FMSettings"); //
### what a wrong group name for these settings...
+
     tabOptions->m_pShowMMBInTabs->setChecked(
cg.readEntry( "MMBOpensTab", false ) );
     tabOptions->m_pDynamicTabbarHide->setChecked( !
(cg.readEntry( "AlwaysTabbedMode", false )) );
 
 -113,7
+124,7 
 
 void KKonqGeneralOptions::defaults()
 {
-    homeURL->setUrl(KUrl("~"));
+    homeURL->setUrl(KUrl(DEFAULT_HOMEPAGE));
 
     bool old = m_pConfig->readDefaults();
     m_pConfig->setReadDefaults(true);
 -123,8
+134,10 
 
 void KKonqGeneralOptions::save()
 {
+    KConfigGroup userSettings(m_pConfig,
"UserSettings");
+    userSettings.writeEntry("HomeURL",
homeURL->url().url());
+
     KConfigGroup cg(m_pConfig, "FMSettings");
-    cg.writeEntry( "HomeURL",
homeURL->url().isEmpty()? QString("~") :
homeURL->url().url() );
     cg.writeEntry( "MMBOpensTab",
tabOptions->m_pShowMMBInTabs->isChecked() );
     cg.writeEntry( "AlwaysTabbedMode",
!(tabOptions->m_pDynamicTabbarHide->isChecked()) );
 
---
trunk/KDE/kdebase/apps/konqueror/settings/konqhtml/generalop
ts.h #801853:801854
 -17,6
+17,7 
 
 class KUrlRequester;
 class Ui_advancedTabOptions;
+class QVBoxLayout;
 
 class KKonqGeneralOptions : public KCModule
 {
 -33,6
+34,8 
     void slotChanged();
 
 private:
+    void addHomeUrlWidgets(QVBoxLayout*);
+
     KSharedConfig::Ptr m_pConfig;
 
     KUrlRequester *homeURL;
--- trunk/KDE/kdebase/apps/konqueror/src/konqmainwindow.cpp
#801853:801854
 -1732,11
+1732,8 
 
 void KonqMainWindow::slotHome(Qt::MouseButtons buttons,
Qt::KeyboardModifiers modifiers)
 {
-    QString homeURL = m_pViewManager->profileHomeURL();
+    const QString homeURL = KonqMisc::homeUrl();
 
-    if (homeURL.isEmpty())
-	homeURL = KonqFMSettings::settings()->homeUrl();
-
     KonqOpenURLRequest req;
     req.newTab = true;
     req.newTabInFront = KonqSettings::newTabsInFront();
--- trunk/KDE/kdebase/apps/konqueror/src/konqmisc.cpp
#801853:801854
 -17,6
+17,7 
    Boston, MA 02110-1301, USA.
 */
 #include "konqmisc.h"
+#include "konqsettingsxt.h"
 #include "konqmainwindow.h"
 #include "konqviewmanager.h"
 #include "konqview.h"
 -32,11
+33,14 
 #include <kstartupinfo.h>
 #include <kiconloader.h>
 #include <kconfiggroup.h>
+#include <QDir>
 
-#ifdef Q_WS_WIN
+//#ifdef Q_WS_WIN
 // windows defines ERROR
-#undef ERROR
-#endif
+// DF: so? we are not using it here...
+//#undef ERROR
+//#endif
+
 /**********************************************
  *
  * KonqMisc
 -225,4
+229,22 
     }
 }
 
+QString KonqMisc::homeUrl()
+{
+    // Note that we have a GUI for configuring konquerorrc
[UserSettings] HomeURL
+    // but there is no GUI for kfmrc [UserSettings] HomeURL
-- hidden config key for now,
+    // I think that breaking "the home icon is your
home directory" would be quite a strange idea.
+
+    // TODO: however it would be good to give the home
button a different icon in webbrowsing
+    // and in filemanager mode.
+
+    if (s_mode == KonqMisc::WebBrowser)
+        return KonqSettings::homeURL();
+
+    // Note that the default value is different for
konquerorrc and kfmrc so we can't use a single code path
anyway.
+
+    const QString homeUrl =
modeDependentConfig()->group("UserSettings").re
adEntry("HomeURL", QDir::homePath());
+    return homeUrl;
+}
+
 #include "konqmisc.moc"
--- trunk/KDE/kdebase/apps/konqueror/src/konqmisc.h
#801853:801854
 -51,6
+51,11 
     KSharedConfigPtr modeDependentConfig();
 
     /**
+     * Returns the (mode-dependent) URL to use for the home
button
+     */
+    QString homeUrl();
+
+    /**
      * Stop full-screen mode in all windows.
      */
     void abortFullScreenMode();
--- trunk/KDE/kdebase/apps/konqueror/src/konqsettings.cpp
#801853:801854
 -65,7
+65,6 
 
 void KonqFMSettings::init(const KConfigGroup &config)
 {
-    m_homeURL = config.readPathEntry("HomeURL",
"~");
     const KSharedConfig::Ptr fileTypesConfig =
KSharedConfig::openConfig("filetypesrc",
KConfig::NoGlobals);
     m_embedMap =
fileTypesConfig->entryMap("EmbedSettings");
 }
 -96,8
+95,3 
         return true;
     return false;
 }
-
-QString KonqFMSettings::homeUrl() const
-{
-    return m_homeURL;
-}
--- trunk/KDE/kdebase/apps/konqueror/src/konqsettings.h
#801853:801854
 -25,6
+25,8 
 
 class KConfigGroup;
 
+// TODO rename this file to konqfmsettings.h, or rename the
class to KonqEmbedSettings in a konqembedsettings.h header
+
 /**
  * Konqueror settings coming from KControl modules.
  *
 -53,8
+55,6 
     // Only makes sense in konqueror.
     bool shouldEmbed( const QString & serviceType )
const;
 
-    QString homeUrl() const;
-
 private:
     /**
      * internal
 -71,8
+71,6 
 
     QMap<QString, QString> m_embedMap;
 
-    QString m_homeURL;
-
     /** Called by constructor and reparseConfiguration */
     void init(const KConfigGroup &config);
 
--- trunk/KDE/kdebase/apps/konqueror/src/konqueror.kcfg
#801853:801854
 -5,6
+5,14 
                           
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd"
>
   <kcfgfile name="konquerorrc" />
 
+  <group name="UserSettings">
+    <entry key="HomeURL"
type="Path">
+      <default>http://www.kde.org
</default> 
+      <label>Home Page</label>
+      <whatsthis>This is the URL of the web page
where Konqueror (as web browser) will jump to when the
"Home" button is pressed. When Konqueror is
started as a file manager, that button makes it jump to your
local home folder instead.</whatsthis>
+      <!-- checked -->
+    </entry>
+  </group>
 
   <group name="FMSettings">
 <!-- behaviour.cpp -->  
 -14,12
+22,6 
       <whatsthis>If this option is checked, Konqueror
will open a new window when you open a folder, rather than
showing that folder's contents in the current
window.</whatsthis>
       <!-- checked -->
     </entry>
-    <entry key="HomeURL"
type="Path">
-      <default>~</default> 
-      <label>Home Folder</label>
-      <whatsthis>This is the URL (e.g. a folder or a
web page) where Konqueror will jump to when the
"Home" button is pressed. This is usually your
home folder, symbolized by a 'tilde' (~).</whatsthis>
-      <!-- checked -->
-    </entry>
     <entry key="ShowFileTips"
type="Bool"> <!--LIBKONQ-->
       <default>true</default> 
       <label>Show file tips</label>
--- trunk/KDE/kdebase/apps/konqueror/src/konqviewmanager.cpp
#801853:801854
 -874,12
+874,12 
 
     KConfigGroup profileGroup(_cfg, "Profile");
 
-    m_profileHomeURL =
profileGroup.readPathEntry("HomeURL", QString());
// TODO remove
-
 #if 0 // This isn't needed, the size should always be there
in the profile anyway
     if( resetWindow ) {
        
m_pMainWindow->applyMainWindowSettings(KConfigGroup(KonqM
isc::modeDependentConfig(),"KonqMainWindow"),
true);
     }
+#else
+    Q_UNUSED(resetWindow); // cleanup the argument once the
above is confirmed
 #endif
 
     loadViewProfileFromGroup( profileGroup, filename,
forcedUrl, req, openUrl );
--- trunk/KDE/kdebase/apps/konqueror/src/konqviewmanager.h
#801853:801854
 -291,8
+291,6 
 
   void showHTML(bool b);
 
-  QString profileHomeURL() const { return m_profileHomeURL;
}
-
 public Q_SLOTS:
     /**
      * Opens a previously closed tab in a new tab
 -388,7
+386,6 
   bool m_bLoadingProfile;
   QString m_currentProfile;
   QString m_currentProfileText;
-  QString m_profileHomeURL;
 
     QMap<QString /*display name*/, QString /*path to
file*/> m_mapProfileNames;
 
_______________________________________________
kde-docbook mailing list
kde-docbookkde.org
htt
ps://mail.kde.org/mailman/listinfo/kde-docbook

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )