]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Added setters in urlnavigator to remove dependency on dolphinsettings.
authorDavid Faure <faure@kde.org>
Tue, 27 Mar 2007 19:38:32 +0000 (19:38 +0000)
committerDavid Faure <faure@kde.org>
Tue, 27 Mar 2007 19:38:32 +0000 (19:38 +0000)
Removed old unused kfileiconview.h header, fixed some unrelated missing includes due to that one being removed.

svn path=/trunk/KDE/kdebase/apps/; revision=647244

13 files changed:
src/bookmarkselector.cpp
src/bookmarkssidebarpage.cpp
src/dolphincontextmenu.cpp
src/dolphinmainwindow.cpp
src/dolphinview.cpp
src/dolphinview.h
src/editbookmarkdialog.cpp
src/generalsettingspage.cpp
src/urlnavigator.cpp
src/urlnavigator.h
src/viewproperties.cpp
src/viewpropertiesdialog.cpp
src/viewsettingspage.cpp

index 1e4aaadc928eb09c604ef7dd106670a670695278..fbd066c8b718517285687df1d2a6044f24e63d2a 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <QPainter>
 #include <QPixmap>
+#include <kicon.h>
 
 BookmarkSelector::BookmarkSelector(UrlNavigator* parent, KBookmarkManager* bookmarkManager) :
     UrlButton(parent),
@@ -84,7 +85,7 @@ void BookmarkSelector::updateSelection(const KUrl& url)
         m_selectedAddress = QString();
         // No bookmark has been found which matches to the given Url. Show
         // a generic folder icon as pixmap for indication:
-        setIcon(SmallIcon("folder"));
+        setIcon(KIcon("folder"));
     }
 }
 
index b68fd58e5a75b82ddd8c7bcd87478deb1e2d9b5c..bf7711aaf6b48da408abd2876030177f55057e23 100644 (file)
@@ -110,15 +110,15 @@ void BookmarksSidebarPage::slotContextMenuRequested(Q3ListBoxItem* item,
 
     KMenu* popup = new KMenu();
     if (item == 0) {
-        QAction *action = popup->addAction(SmallIcon("document-new"), i18n("Add Bookmark..."));
+        QAction *action = popup->addAction(KIcon("document-new"), i18n("Add Bookmark..."));
        action->setData(addID);
     }
     else {
-        QAction *action = popup->addAction(SmallIcon("document-new"), i18n("Insert Bookmark..."));
+        QAction *action = popup->addAction(KIcon("document-new"), i18n("Insert Bookmark..."));
        action->setData(insertID);
-        action = popup->addAction(SmallIcon("edit"), i18n("Edit..."));
+        action = popup->addAction(KIcon("edit"), i18n("Edit..."));
        action->setData(editID);
-        action = popup->addAction(SmallIcon("edit-delete"), i18n("Delete"));
+        action = popup->addAction(KIcon("edit-delete"), i18n("Delete"));
        action->setData(deleteID);
 
     }
index fff3b5ac30d30711c8b066a42bad3f9873ea057c..620520057bdd2eadd229c7e1e2abc7643b2d96a8 100644 (file)
@@ -47,6 +47,7 @@
 #include <QApplication>
 #include <QClipboard>
 #include <QDir>
+#include <Q3ValueList>
 
 DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent,
                                        KFileItem* fileInfo,
index 278d63c97696ad7f14365cfcf946339812560e6e..8d877495bce501c3ca56b1fb8b22feb711b2c68e 100644 (file)
@@ -1083,7 +1083,7 @@ void DolphinMainWindow::setupActions()
     m_newMenu = new DolphinNewMenu(this);\r
     KMenu* menu = m_newMenu->menu();\r
     menu->setTitle(i18n("Create New..."));\r
-    menu->setIcon(SmallIcon("document-new"));\r
+    menu->setIcon(KIcon("document-new"));\r
     connect(menu, SIGNAL(aboutToShow()),\r
             this, SLOT(updateNewMenu()));\r
 \r
index 04b949a7d3c3f78453e8f306396e24704623bed7..88a2cff80ffad1c484ce86e2354c3ff0d5cd8091 100644 (file)
@@ -26,6 +26,8 @@
 #include <QItemSelectionModel>
 #include <QMouseEvent>
 #include <QVBoxLayout>
+#include <QTimer>
+#include <QScrollBar>
 
 #include <kdirmodel.h>
 #include <kfileitemdelegate.h>
@@ -53,6 +55,7 @@
 #include "urlnavigator.h"
 #include "viewproperties.h"
 #include "dolphinsettings.h"
+#include "dolphin_generalsettings.h"
 
 DolphinView::DolphinView(DolphinMainWindow* mainWindow,
                          QWidget* parent,
@@ -94,6 +97,8 @@ DolphinView::DolphinView(DolphinMainWindow* mainWindow,
             this, SLOT(updateCutItems()));
 
     m_urlNavigator = new UrlNavigator(DolphinSettings::instance().bookmarkManager(), url, this);
+    m_urlNavigator->setUrlEditable(DolphinSettings::instance().generalSettings()->editableUrl());
+    m_urlNavigator->setHomeUrl(DolphinSettings::instance().generalSettings()->homeUrl());
     m_urlNavigator->setShowHiddenFiles(showHiddenFiles);
     connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)),
             this, SLOT(loadDirectory(const KUrl&)));
@@ -342,7 +347,6 @@ DolphinStatusBar* DolphinView::statusBar() const
 
 int DolphinView::contentsX() const
 {
-
     return itemView()->horizontalScrollBar()->value();
 }
 
@@ -453,7 +457,7 @@ void DolphinView::goHome()
 
 void DolphinView::setUrlEditable(bool editable)
 {
-    m_urlNavigator->editUrl(editable);
+    m_urlNavigator->setUrlEditable(editable);
 }
 
 bool DolphinView::hasSelection() const
index 6aabf2d34652e6ba0848ac17e45977bc25af5b87..0569ba4002dc08f589e6227d0b49e6af490d873b 100644 (file)
@@ -25,7 +25,6 @@
 #include <kparts/part.h>
 #include <kfileitem.h>
 #include <kfileitemdelegate.h>
-#include <kfileiconview.h>
 #include <kio/job.h>
 
 #include <urlnavigator.h>
index 12be5b2ca326c947d73716159ebb9a313b17fdc8..eed5af46212beff9cd2c54d90247b24b5ef218e2 100644 (file)
@@ -83,7 +83,7 @@ EditBookmarkDialog::EditBookmarkDialog(const QString& title,
     // create icon widgets
     new QLabel(i18n("Icon:"), grid);
     m_iconName = icon;
-    m_iconButton = new QPushButton(SmallIcon(m_iconName), QString(), grid);
+    m_iconButton = new QPushButton(KIcon(m_iconName), QString(), grid);
     m_iconButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
     connect(m_iconButton, SIGNAL(clicked()),
             this, SLOT(selectIcon()));
@@ -103,7 +103,7 @@ EditBookmarkDialog::EditBookmarkDialog(const QString& title,
     m_location = new QLineEdit(url.prettyUrl(), locationBox);
     m_location->setMinimumWidth(320);
 
-    QPushButton* selectLocationButton = new QPushButton(SmallIcon("folder"), QString(), locationBox);
+    QPushButton* selectLocationButton = new QPushButton(KIcon("folder"), QString(), locationBox);
     selectLocationButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
     connect(selectLocationButton, SIGNAL(clicked()),
             this, SLOT(selectLocation()));
@@ -116,7 +116,7 @@ void EditBookmarkDialog::selectIcon()
     const QString iconName(KIconDialog::getIcon(K3Icon::Small, K3Icon::FileSystem));
     if (!iconName.isEmpty()) {
         m_iconName = iconName;
-        m_iconButton->setIconSet(SmallIcon(iconName));
+        m_iconButton->setIcon(KIcon(iconName));
     }
 }
 
index 8d1389b594563fe6a3307390933e3ec7ee4bafc6..8ac1a37eab691fbdf4ade44e43a4c09f06a36c10 100644 (file)
@@ -62,7 +62,7 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin,QWidget* par
     new QLabel(i18n("Location:"), homeUrlBox);
     m_homeUrl = new QLineEdit(settings->homeUrl(), homeUrlBox);
 
-    QPushButton* selectHomeUrlButton = new QPushButton(SmallIcon("folder"), QString(), homeUrlBox);
+    QPushButton* selectHomeUrlButton = new QPushButton(KIcon("folder"), QString(), homeUrlBox);
     connect(selectHomeUrlButton, SIGNAL(clicked()),
             this, SLOT(selectHomeUrl()));
 
index 7d7ef5e756367d73b266ac5b8dd826025a1636b9..8a0225e375051dbb64b3302a549f33e9d6439f1d 100644 (file)
@@ -22,8 +22,6 @@
 #include "urlnavigator.h"
 
 #include "bookmarkselector.h"
-#include "dolphinsettings.h"
-#include "dolphin_generalsettings.h"
 #include "protocolcombo.h"
 #include "urlnavigatorbutton.h"
 
@@ -89,13 +87,6 @@ public:
      */
     void switchView();
 
-    /**
-     * Allows to edit the Url of the navigation bar if \a editable
-     * is true. If \a editable is false, each part of
-     * the Url is presented by a button for a fast navigation.
-     */
-    void setUrlEditable(bool editable);
-
     /**
      * Updates the history element with the current file item
      * and the contents position.
@@ -135,6 +126,7 @@ public:
     QLineEdit* m_host;
     QLinkedList<UrlNavigatorButton*> m_navButtons;
     QWidget* m_filler;
+    QString m_homeUrl;
     UrlNavigator* q;
 };
 
@@ -199,14 +191,6 @@ void UrlNavigator::Private::appendWidget(QWidget* widget)
     m_layout->insertWidget(m_layout->count() - 1, widget);
 }
 
-void UrlNavigator::Private::setUrlEditable(bool editable)
-{
-    if (q->isUrlEditable() != editable) {
-        m_toggleButton->toggle();
-        switchView();
-    }
-}
-
 void UrlNavigator::Private::slotReturnPressed(const QString& text)
 {
     // Parts of the following code have been taken
@@ -572,10 +556,6 @@ UrlNavigator::UrlNavigator(KBookmarkManager* bookmarkManager,
     QFontMetrics fontMetrics(font());
     setMinimumHeight(fontMetrics.height() + 10);
 
-    if (DolphinSettings::instance().generalSettings()->editableUrl()) {
-        d->m_toggleButton->toggle();
-    }
-
     setLayout(d->m_layout);
 
     d->updateContent();
@@ -652,7 +632,10 @@ void UrlNavigator::goUp()
 
 void UrlNavigator::goHome()
 {
-    setUrl(DolphinSettings::instance().generalSettings()->homeUrl());
+    if (d->m_homeUrl.isEmpty())
+        setUrl(QDir::homePath());
+    else
+        setUrl(d->m_homeUrl);
 }
 
 bool UrlNavigator::isUrlEditable() const
@@ -660,11 +643,11 @@ bool UrlNavigator::isUrlEditable() const
     return d->m_toggleButton->isChecked();
 }
 
-void UrlNavigator::editUrl(bool editOrBrowse)
+void UrlNavigator::setUrlEditable(bool editable)
 {
-    d->setUrlEditable(editOrBrowse);
-    if (editOrBrowse) {
-        d->m_pathBox->setFocus();
+    if (isUrlEditable() != editable) {
+        d->m_toggleButton->toggle();
+        d->switchView();
     }
 }
 
@@ -705,7 +688,7 @@ void UrlNavigator::setUrl(const KUrl& url)
     if ( urlStr.length() > 0 && urlStr.at(0) == '~') {
         // replace '~' by the home directory
         urlStr.remove(0, 1);
-        urlStr.insert(0, QDir::home().path());
+        urlStr.insert(0, QDir::homePath());
     }
 
     const KUrl transformedUrl(urlStr);
@@ -772,7 +755,7 @@ void UrlNavigator::keyReleaseEvent(QKeyEvent* event)
 {
     QWidget::keyReleaseEvent(event);
     if (isUrlEditable() && (event->key() == Qt::Key_Escape)) {
-        d->setUrlEditable(false);
+        setUrlEditable(false);
     }
 }
 
@@ -799,4 +782,9 @@ bool UrlNavigator::showHiddenFiles() const
     return d->m_showHiddenFiles;
 }
 
+void UrlNavigator::setHomeUrl(const QString& homeUrl)
+{
+    d->m_homeUrl = homeUrl;
+}
+
 #include "urlnavigator.moc"
index 15b683576a1d1e89c76ea757c028429f354bab82..4b277d1b8a5472aa0639ddaa22946f030c3f92af 100644 (file)
@@ -24,7 +24,6 @@
 
 #include <kurl.h>
 #include <QWidget>
-#include <QList>
 
 class KBookmarkManager;
 class QMouseEvent;
@@ -129,6 +128,11 @@ public:
      */
     void goHome();
 
+    /**
+     * Sets the home URL used by goHome().
+     */
+    void setHomeUrl(const QString& homeUrl);
+
     /**
      * @return True, if the URL is editable by the user within a line editor.
      *         If false is returned, each part of the URL is presented by a button
@@ -137,16 +141,18 @@ public:
     bool isUrlEditable() const;
 
     /**
-     * Switches to the edit mode and assures that the keyboard focus
-     * is assigned.
+     * Allows to edit the URL of the navigation bar if \a editable
+     * is true, and sets the focus accordingly.
+     * If \a editable is false, each part of
+     * the URL is presented by a button for a fast navigation.
      */
-    void editUrl(bool editOrBrowse); //TODO: switch to an enum
+    void setUrlEditable(bool editable);
 
     /**
      * Set the URL navigator to the active mode, if \a active
      * is true. The active mode is default. Using the URL navigator
      * in the inactive mode is useful when having split views,
-     * where the inactive view is indicated by a an inactive URL
+     * where the inactive view is indicated by an inactive URL
      * navigator visually.
      */
     void setActive(bool active);
index d3fe7224627abaeb6f2fb9a3476c014bd2d4e1a8..5d652281a14c8e9c1f55ef4a50325a71c7bbc226 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <QDateTime>
 #include <QFile>
+#include <QFileInfo>
 
 #include <kcomponentdata.h>
 #include <klocale.h>
index 3353097e0c149f34fb33a323171d139dd5e3c742..58b388893520a359ae92b35e8661b3a6389366d8 100644 (file)
@@ -79,8 +79,8 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
 
     QLabel* viewModeLabel = new QLabel(i18n("View mode:"), propsBox);
     m_viewMode = new QComboBox(propsBox);
-    m_viewMode->addItem(SmallIcon("view-icon"), i18n("Icons"));
-    m_viewMode->addItem(SmallIcon("fileview-text"), i18n("Details"));
+    m_viewMode->addItem(KIcon("view-icon"), i18n("Icons"));
+    m_viewMode->addItem(KIcon("fileview-text"), i18n("Details"));
     const int index = static_cast<int>(m_viewProps->viewMode());
     m_viewMode->setCurrentIndex(index);
 
index 5cf3c2b36705812110cfa3aaa8dc89478f5a1933..654a09f28ec71fa1f3a5e46e171d22ec44effcfc 100644 (file)
@@ -47,15 +47,15 @@ ViewSettingsPage::ViewSettingsPage(DolphinMainWindow* mainWindow,
 
     // initialize 'General' tab
     m_generalPage = new GeneralViewSettingsPage(mainWindow, tabWidget);
-    tabWidget->addTab(m_generalPage, SmallIcon("view-choose"), i18n("General"));
+    tabWidget->addTab(m_generalPage, KIcon("view-choose"), i18n("General"));
 
     // initialize 'Icons' tab
     m_iconsPage = new IconsViewSettingsPage(mainWindow, tabWidget);
-    tabWidget->addTab(m_iconsPage, SmallIcon("view-icon"), i18n("Icons"));
+    tabWidget->addTab(m_iconsPage, KIcon("view-icon"), i18n("Icons"));
 
     // initialize 'Details' tab
     m_detailsPage = new DetailsViewSettingsPage(mainWindow, tabWidget);
-    tabWidget->addTab(m_detailsPage, SmallIcon("fileview-text"), i18n("Details"));
+    tabWidget->addTab(m_detailsPage, KIcon("fileview-text"), i18n("Details"));
 
     topLayout->addWidget(tabWidget, 0, 0 );
 }