]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Add a new config option for the icon size in the Places Panel
authorFrank Reininghaus <frank78ac@googlemail.com>
Thu, 27 Sep 2012 06:11:53 +0000 (08:11 +0200)
committerFrank Reininghaus <frank78ac@googlemail.com>
Thu, 27 Sep 2012 06:12:02 +0000 (08:12 +0200)
To change the icon size in the Places Panel to, e.g., 60 pixels, add
the following lines to $KDEHOME/share/config/dolphinrc :

[PlacesPanel]
IconSize=60

A value of -1 means that the standard "Small" size should be used
(which has been the default before this commit).

It is planned to add an "Icon Size" submenu to the context menu of the
Places Panel in KDE 4.10, but we cannot do this in the 4.9 branch
because of the string freeze.

FIXED-IN: 4.9.2
BUG: 301959

src/CMakeLists.txt
src/panels/places/dolphin_placespanelsettings.kcfg [new file with mode: 0644]
src/panels/places/dolphin_placespanelsettings.kcfgc [new file with mode: 0644]
src/panels/places/placespanel.cpp
src/panels/places/placesview.cpp [new file with mode: 0644]
src/panels/places/placesview.h [new file with mode: 0644]

index 1c6b40c4b49541dce883eecf9621d1d199ddde08..8f7f4db7789b2824fb44cfd3c8cfdc4c9886cf6a 100644 (file)
@@ -171,6 +171,7 @@ set(dolphin_SRCS
     panels/places/placesitemlistwidget.cpp
     panels/places/placesitemmodel.cpp
     panels/places/placesitemsignalhandler.cpp
+    panels/places/placesview.cpp
     panels/panel.cpp
     panels/folders/foldersitemlistwidget.cpp
     panels/folders/treeviewcontextmenu.cpp
@@ -204,6 +205,7 @@ set(dolphin_SRCS
 kde4_add_kcfg_files(dolphin_SRCS
     panels/folders/dolphin_folderspanelsettings.kcfgc
     panels/information/dolphin_informationpanelsettings.kcfgc
+    panels/places/dolphin_placespanelsettings.kcfgc
     settings/dolphin_compactmodesettings.kcfgc
     settings/dolphin_detailsmodesettings.kcfgc
     settings/dolphin_generalsettings.kcfgc
diff --git a/src/panels/places/dolphin_placespanelsettings.kcfg b/src/panels/places/dolphin_placespanelsettings.kcfg
new file mode 100644 (file)
index 0000000..b2ef8e5
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd">
+<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
+      http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
+    <kcfgfile name="dolphinrc"/>
+    <group name="PlacesPanel">
+        <entry name="IconSize" type="Int">
+            <label>Size of icons in the Places Panel (-1 means "use the style's small size")</label>
+            <default>-1</default>
+        </entry>
+    </group>
+</kcfg>
diff --git a/src/panels/places/dolphin_placespanelsettings.kcfgc b/src/panels/places/dolphin_placespanelsettings.kcfgc
new file mode 100644 (file)
index 0000000..65a77ec
--- /dev/null
@@ -0,0 +1,4 @@
+File=dolphin_placespanelsettings.kcfg
+ClassName=PlacesPanelSettings
+Singleton=true
+Mutators=true
index 4b28c85102fd8573da939379340c4c3fb13204ab..a81b99770b3abbf50023322363fcd83abada6d92 100644 (file)
@@ -33,7 +33,6 @@
 #include <kitemviews/kitemlistcontroller.h>
 #include <kitemviews/kitemlistselectionmanager.h>
 #include <kitemviews/kstandarditem.h>
-#include <kitemviews/kstandarditemlistview.h>
 #include <KMenu>
 #include <KMessageBox>
 #include <KNotification>
@@ -42,6 +41,7 @@
 #include "placesitemlistgroupheader.h"
 #include "placesitemlistwidget.h"
 #include "placesitemmodel.h"
+#include "placesview.h"
 #include <views/draganddrophelper.h>
 #include <QGraphicsSceneDragDropEvent>
 #include <QVBoxLayout>
@@ -94,7 +94,7 @@ void PlacesPanel::showEvent(QShowEvent* event)
         connect(m_model, SIGNAL(errorMessage(QString)),
                 this, SIGNAL(errorMessage(QString)));
 
-        KStandardItemListView* view = new KStandardItemListView();
+        PlacesView* view = new PlacesView();
         view->setWidgetCreator(new KItemListWidgetCreator<PlacesItemListWidget>());
         view->setGroupHeaderCreator(new KItemListGroupHeaderCreator<PlacesItemListGroupHeader>());
 
diff --git a/src/panels/places/placesview.cpp b/src/panels/places/placesview.cpp
new file mode 100644 (file)
index 0000000..dce5083
--- /dev/null
@@ -0,0 +1,35 @@
+/***************************************************************************
+ *   Copyright (C) 2012 by Frank Reininghaus <frank78ac@googlemail.com>    *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
+ ***************************************************************************/
+
+#include "placesview.h"
+
+#include "dolphin_placespanelsettings.h"
+
+PlacesView::PlacesView(QGraphicsWidget* parent) :
+    KStandardItemListView(parent)
+{
+    const int iconSize = PlacesPanelSettings::iconSize();
+    if (iconSize >= 0) {
+        KItemListStyleOption option = styleOption();
+        option.iconSize = iconSize;
+        setStyleOption(option);
+    }
+}
+
+#include "placesview.moc"
diff --git a/src/panels/places/placesview.h b/src/panels/places/placesview.h
new file mode 100644 (file)
index 0000000..87eb3a5
--- /dev/null
@@ -0,0 +1,38 @@
+/***************************************************************************
+ *   Copyright (C) 2012 by Frank Reininghaus <frank78ac@googlemail.com>    *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
+ ***************************************************************************/
+
+#ifndef PLACESVIEW_H
+#define PLACESVIEW_H
+
+#include <kitemviews/kstandarditemlistview.h>
+
+/**
+ * @brief View class for the Places Panel.
+ *
+ * Reads the icon size from GeneralSettings::placesPanelIconSize().
+ */
+class PlacesView : public KStandardItemListView
+{
+    Q_OBJECT
+
+public:
+    explicit PlacesView(QGraphicsWidget* parent = 0);
+};
+
+#endif