)
kde4_add_kcfg_files(dolphinprivate_LIB_SRCS
+ dolphin_columnmodesettings.kcfgc
dolphin_directoryviewpropertysettings.kcfgc
dolphin_detailsmodesettings.kcfgc
dolphin_iconsmodesettings.kcfgc
bookmarkselector.cpp
bookmarkssettingspage.cpp
bookmarkssidebarpage.cpp
+ columnviewsettingspage.cpp
detailsviewsettingspage.cpp
dolphinapplication.cpp
dolphincolumnview.cpp
########### install files ###############
install( FILES dolphin.desktop DESTINATION ${XDG_APPS_DIR} )
-install( FILES dolphin_directoryviewpropertysettings.kcfg dolphin_generalsettings.kcfg dolphin_iconsmodesettings.kcfg dolphin_detailsmodesettings.kcfg DESTINATION ${KCFG_INSTALL_DIR} )
+install( FILES dolphin_directoryviewpropertysettings.kcfg dolphin_generalsettings.kcfg dolphin_columnmodesettings.kcfg dolphin_iconsmodesettings.kcfg dolphin_detailsmodesettings.kcfg DESTINATION ${KCFG_INSTALL_DIR} )
install( FILES dolphinui.rc DESTINATION ${DATA_INSTALL_DIR}/dolphin )
kde4_install_icons( ${ICON_INSTALL_DIR} )
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
+ * *
+ * 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 "columnviewsettingspage.h"
+
+#include "dolphinsettings.h"
+#include "dolphin_columnmodesettings.h"
+
+#include <kdialog.h>
+#include <kfontrequester.h>
+#include <klocale.h>
+
+#include <QButtonGroup>
+#include <QCheckBox>
+#include <QComboBox>
+#include <QGroupBox>
+#include <QGridLayout>
+#include <QLabel>
+#include <QRadioButton>
+#include <QSpinBox>
+
+ColumnViewSettingsPage::ColumnViewSettingsPage(DolphinMainWindow* mainWindow,
+ QWidget* parent) :
+ KVBox(parent),
+ m_mainWindow(mainWindow),
+ m_smallIconSize(0),
+ m_mediumIconSize(0),
+ m_largeIconSize(0),
+ m_fontRequester(0)
+{
+ const int spacing = KDialog::spacingHint();
+ const int margin = KDialog::marginHint();
+ const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
+
+ setSpacing(spacing);
+ setMargin(margin);
+
+ ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings();
+ Q_ASSERT(settings != 0);
+
+ // Create "Icon" properties
+ QGroupBox* iconSizeBox = new QGroupBox(i18n("Icon Size"), this);
+ iconSizeBox->setSizePolicy(sizePolicy);
+
+ m_smallIconSize = new QRadioButton(i18n("Small"), this);
+ m_mediumIconSize = new QRadioButton(i18n("Medium"), this);
+ m_largeIconSize = new QRadioButton(i18n("Large"), this);
+ switch (settings->iconSize()) {
+ case K3Icon::SizeLarge:
+ m_largeIconSize->setChecked(true);
+ break;
+
+ case K3Icon::SizeMedium:
+ m_mediumIconSize->setChecked(true);
+ break;
+
+ case K3Icon::SizeSmall:
+ default:
+ m_smallIconSize->setChecked(true);
+ }
+
+ QButtonGroup* iconSizeGroup = new QButtonGroup(this);
+ iconSizeGroup->addButton(m_smallIconSize);
+ iconSizeGroup->addButton(m_mediumIconSize);
+ iconSizeGroup->addButton(m_largeIconSize);
+
+ QHBoxLayout* iconSizeLayout = new QHBoxLayout(iconSizeBox);
+ iconSizeLayout->addWidget(m_smallIconSize);
+ iconSizeLayout->addWidget(m_mediumIconSize);
+ iconSizeLayout->addWidget(m_largeIconSize);
+
+ // create "Text" properties
+ QGroupBox* textBox = new QGroupBox(i18n("Text"), this);
+ textBox->setSizePolicy(sizePolicy);
+
+ QLabel* fontLabel = new QLabel(i18n("Font:"), textBox);
+ m_fontRequester = new KFontRequester(textBox);
+ QFont font(settings->fontFamily(),
+ settings->fontSize());
+ font.setItalic(settings->italicFont());
+ font.setBold(settings->boldFont());
+ m_fontRequester->setFont(font);
+
+ QHBoxLayout* textLayout = new QHBoxLayout(textBox);
+ textLayout->addWidget(fontLabel);
+ textLayout->addWidget(m_fontRequester);
+
+ // Add a dummy widget with no restriction regarding
+ // a vertical resizing. This assures that the dialog layout
+ // is not stretched vertically.
+ new QWidget(this);
+}
+
+ColumnViewSettingsPage::~ColumnViewSettingsPage()
+{
+}
+
+void ColumnViewSettingsPage::applySettings()
+{
+ ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings();
+ Q_ASSERT(settings != 0);
+
+ int iconSize = K3Icon::SizeSmall;
+ if (m_mediumIconSize->isChecked()) {
+ iconSize = K3Icon::SizeMedium;
+ }
+ else if (m_largeIconSize->isChecked()) {
+ iconSize = K3Icon::SizeLarge;
+ }
+ settings->setIconSize(iconSize);
+
+ const QFont font = m_fontRequester->font();
+ settings->setFontFamily(font.family());
+ settings->setFontSize(font.pointSize());
+ settings->setItalicFont(font.italic());
+ settings->setBoldFont(font.bold());
+}
+
+#include "columnviewsettingspage.moc"
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
+ * *
+ * 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 COLUMNVIEWSETTINGSPAGE_H
+#define COLUMNVIEWSETTINGSPAGE_H
+
+#include <kvbox.h>
+
+class DolphinMainWindow;
+class KFontRequester;
+class QCheckBox;
+class QSpinBox;
+class QComboBox;
+class QRadioButton;
+
+/**
+ * @brief Represents the page from the Dolphin Settings which allows
+ * to modify the settings for the details view.
+ */
+class ColumnViewSettingsPage : public KVBox
+{
+ Q_OBJECT
+
+public:
+ ColumnViewSettingsPage(DolphinMainWindow* mainWindow, QWidget* parent);
+ virtual ~ColumnViewSettingsPage();
+
+ /**
+ * Applies the settings for the details view.
+ * The settings are persisted automatically when
+ * closing Dolphin.
+ */
+ void applySettings();
+
+private:
+ DolphinMainWindow* m_mainWindow;
+ QRadioButton* m_smallIconSize;
+ QRadioButton* m_mediumIconSize;
+ QRadioButton* m_largeIconSize;
+ KFontRequester* m_fontRequester;
+};
+
+#endif
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd">
+<kcfg>
+ <kcfgfile name="dolphinrc"/>
+ <include>kiconloader.h</include>
+ <include>kglobalsettings.h</include>
+ <group name="ColumnMode">
+ <entry name="FontFamily" type="String">
+ <label>Font family</label>
+ <default code="true">KGlobalSettings::generalFont().family()</default>
+ </entry>
+ <entry name="FontSize" type="Int">
+ <label>Font size</label>
+ <default code="true">KGlobalSettings::generalFont().pointSize()</default>
+ </entry>
+ <entry name="ItalicFont" type="Bool">
+ <label>Italic</label>
+ <default>false</default>
+ </entry>
+ <entry name="BoldFont" type="Bool">
+ <label>Bold</label>
+ <default>false</default>
+ </entry>
+ <entry name="IconSize" type="Int">
+ <label>Icon size</label>
+ <default code="true">K3Icon::SizeSmall</default>
+ </entry>
+ </group>
+</kcfg>
\ No newline at end of file
--- /dev/null
+File=dolphin_columnmodesettings.kcfg
+ClassName=ColumnModeSettings
+Singleton=false
+Mutators=true
#include "dolphincontroller.h"
#include "dolphinsettings.h"
-//#include "dolphin_iconsmodesettings.h"
+#include "dolphin_columnmodesettings.h"
#include <kdirmodel.h>
#include <kfileitem.h>
connect(controller, SIGNAL(zoomOut()),
this, SLOT(zoomOut()));
- // apply the icons mode settings to the widget
- //const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
- //Q_ASSERT(settings != 0);
+ // apply the column mode settings to the widget
+ const ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings();
+ Q_ASSERT(settings != 0);
m_viewOptions = QColumnView::viewOptions();
- /*QFont font(settings->fontFamily(), settings->fontSize());
+ QFont font(settings->fontFamily(), settings->fontSize());
font.setItalic(settings->italicFont());
font.setBold(settings->boldFont());
m_viewOptions.font = font;
- updateGridSize(controller->showPreview());
-
- if (settings->arrangement() == QColumnView::TopToBottom) {
- setFlow(QColumnView::LeftToRight);
- m_viewOptions.decorationPosition = QStyleOptionViewItem::Top;
- }
- else {
- setFlow(QColumnView::TopToBottom);
- m_viewOptions.decorationPosition = QStyleOptionViewItem::Left;
- }*/
+ updateDecorationSize();
}
DolphinColumnView::~DolphinColumnView()
void DolphinColumnView::zoomIn()
{
+ if (isZoomInPossible()) {
+ ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings();
+ // TODO: get rid of K3Icon sizes
+ switch (settings->iconSize()) {
+ case K3Icon::SizeSmall: settings->setIconSize(K3Icon::SizeMedium); break;
+ case K3Icon::SizeMedium: settings->setIconSize(K3Icon::SizeLarge); break;
+ default: Q_ASSERT(false); break;
+ }
+ updateDecorationSize();
+ }
}
void DolphinColumnView::zoomOut()
{
+ if (isZoomOutPossible()) {
+ ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings();
+ // TODO: get rid of K3Icon sizes
+ switch (settings->iconSize()) {
+ case K3Icon::SizeLarge: settings->setIconSize(K3Icon::SizeMedium); break;
+ case K3Icon::SizeMedium: settings->setIconSize(K3Icon::SizeSmall); break;
+ default: Q_ASSERT(false); break;
+ }
+ updateDecorationSize();
+ }
}
bool DolphinColumnView::isZoomInPossible() const
{
- return false;
+ ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings();
+ return settings->iconSize() < K3Icon::SizeLarge;
}
bool DolphinColumnView::isZoomOutPossible() const
{
- return false;
+ ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings();
+ return settings->iconSize() > K3Icon::SizeSmall;
+}
+
+void DolphinColumnView::updateDecorationSize()
+{
+ ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings();
+ const int iconSize = settings->iconSize();
+ m_viewOptions.decorationSize = QSize(iconSize, iconSize);
+
+ m_controller->setZoomInPossible(isZoomInPossible());
+ m_controller->setZoomOutPossible(isZoomOutPossible());
+
+ doItemsLayout();
}
#include "dolphincolumnview.moc"
bool isZoomInPossible() const;
bool isZoomOutPossible() const;
+ /**
+ * Updates the size of the decoration dependent on the
+ * icon size of the ColumnModeSettings. The controller
+ * will get informed about possible zoom in/zoom out
+ * operations.
+ */
+ void updateDecorationSize();
+
private:
DolphinController* m_controller;
QStyleOptionViewItem m_viewOptions;
#include <klocale.h>
#include <kstandarddirs.h>
+#include "dolphin_columnmodesettings.h"
+#include "dolphin_detailsmodesettings.h"
#include "dolphin_generalsettings.h"
#include "dolphin_iconsmodesettings.h"
-#include "dolphin_detailsmodesettings.h"
DolphinSettings& DolphinSettings::instance()
{
KBookmark DolphinSettings::bookmark(int index) const
{
- return bookmarkManager()->findByAddress( QString('/')+QString::number(index) );
+ return bookmarkManager()->findByAddress(QString('/') + QString::number(index));
}
KBookmarkManager* DolphinSettings::bookmarkManager() const
m_generalSettings->writeConfig();
m_iconsModeSettings->writeConfig();
m_detailsModeSettings->writeConfig();
+ m_columnModeSettings->writeConfig();
QString basePath = KGlobal::mainComponent().componentName();
basePath.append("/bookmarks.xml");
m_generalSettings = new GeneralSettings();
m_iconsModeSettings = new IconsModeSettings();
m_detailsModeSettings = new DetailsModeSettings();
+ m_columnModeSettings = new ColumnModeSettings();
}
DolphinSettings::~DolphinSettings()
delete m_detailsModeSettings;
m_detailsModeSettings = 0;
+
+ delete m_columnModeSettings;
+ m_columnModeSettings = 0;
}
#include <libdolphin_export.h>
-class KBookmark;
-class KBookmarkManager;
+class ColumnModeSettings;
+class DetailsModeSettings;
class GeneralSettings;
class IconsModeSettings;
-class DetailsModeSettings;
+class KBookmark;
+class KBookmarkManager;
/**
* @brief Manages and stores all settings from Dolphin.
GeneralSettings* generalSettings() const { return m_generalSettings; }
IconsModeSettings* iconsModeSettings() const { return m_iconsModeSettings; }
DetailsModeSettings* detailsModeSettings() const { return m_detailsModeSettings; }
+ ColumnModeSettings* columnModeSettings() const { return m_columnModeSettings; }
KBookmarkManager* bookmarkManager() const;
GeneralSettings* m_generalSettings;
IconsModeSettings* m_iconsModeSettings;
DetailsModeSettings* m_detailsModeSettings;
+ ColumnModeSettings* m_columnModeSettings;
};
#endif
KPageDialog(),
m_mainWindow(mainWindow)
{
+ const QSize minSize = minimumSize();
+ setMinimumSize(QSize(512, minSize.height()));
+
setFaceType( List);
setCaption(i18n("Dolphin Preferences"));
setButtons(Ok|Apply|Cancel);
m_viewMode = new QComboBox(propsBox);
m_viewMode->addItem(KIcon("view-icon"), i18n("Icons"));
m_viewMode->addItem(KIcon("fileview-text"), i18n("Details"));
+ m_viewMode->addItem(KIcon("view-tree"), i18n("Column"));
const int index = static_cast<int>(m_viewProps->viewMode());
m_viewMode->setCurrentIndex(index);
void ViewPropertiesDialog::slotViewModeChanged(int index)
{
- Q_ASSERT((index >= 0) && (index <= 1));
m_viewProps->setViewMode(static_cast<DolphinView::Mode>(index));
m_isDirty = true;
***************************************************************************/
#include "viewsettingspage.h"
+
+#include "columnviewsettingspage.h"
+#include "detailsviewsettingspage.h"
#include "generalviewsettingspage.h"
#include "iconsviewsettingspage.h"
-#include "detailsviewsettingspage.h"
#include <QVBoxLayout>
#include <QTabWidget>
SettingsPageBase(parent),
m_generalPage(0),
m_iconsPage(0),
- m_detailsPage(0)
+ m_detailsPage(0),
+ m_columnPage(0)
{
QVBoxLayout* topLayout = new QVBoxLayout(this);
topLayout->setMargin(0);
m_detailsPage = new DetailsViewSettingsPage(mainWindow, tabWidget);
tabWidget->addTab(m_detailsPage, KIcon("fileview-text"), i18n("Details"));
- topLayout->addWidget(tabWidget, 0, 0 );
+ // initialize 'Column' tab
+ m_columnPage = new ColumnViewSettingsPage(mainWindow, tabWidget);
+ tabWidget->addTab(m_columnPage, KIcon("view-tree"), i18n("Column"));
+
+ topLayout->addWidget(tabWidget, 0, 0);
}
ViewSettingsPage::~ViewSettingsPage()
m_generalPage->applySettings();
m_iconsPage->applySettings();
m_detailsPage->applySettings();
+ m_columnPage->applySettings();
}
#include "viewsettingspage.moc"
#include <qwidget.h>
#include <settingspagebase.h>
+class ColumnViewSettingsPage;
class DolphinMainWindow;
class GeneralViewSettingsPage;
class IconsViewSettingsPage;
/**
* @brief Page for the 'View' settings of the Dolphin settings dialog.
*
- * The views settings allow to set the properties for the icons mode and
- * the details mode.
+ * The views settings allow to set the properties for the icons mode,
+ * the details mode and the column mode.
*/
class ViewSettingsPage : public SettingsPageBase
{
GeneralViewSettingsPage* m_generalPage;
IconsViewSettingsPage* m_iconsPage;
DetailsViewSettingsPage* m_detailsPage;
+ ColumnViewSettingsPage* m_columnPage;
};
#endif