########### next target ###############
set(dolphin_SRCS
- main.cpp
+ applyviewpropsjob.cpp
+ bookmarkselector.cpp
+ bookmarkssettingspage.cpp
+ bookmarkssidebarpage.cpp
+ detailsviewsettingspage.cpp
dolphinapplication.cpp
dolphinmainwindow.cpp
dolphinview.cpp
- urlnavigator.cpp
- urlnavigatorbutton.cpp
- viewpropertiesdialog.cpp
dolphinstatusbar.cpp
dolphindirlister.cpp
- viewproperties.cpp
dolphindetailsview.cpp
dolphiniconsview.cpp
dolphinsettings.cpp
- bookmarkselector.cpp
- urlbutton.cpp
dolphincontextmenu.cpp
dolphinsortfilterproxymodel.cpp
- undomanager.cpp
- progressindicator.cpp
- iconsviewsettingspage.cpp
- pixmapviewer.cpp
dolphinsettingsdialog.cpp
- viewsettingspage.cpp
- detailsviewsettingspage.cpp
- statusbarmessagelabel.cpp
- generalsettingspage.cpp
- bookmarkssettingspage.cpp
editbookmarkdialog.cpp
+ filterbar.cpp
+ generalsettingspage.cpp
+ generalviewsettingspage.cpp
+ iconsviewsettingspage.cpp
+ infosidebarpage.cpp
+ main.cpp
+ progressindicator.cpp
+ protocolcombo.cpp
+ pixmapviewer.cpp
+ renamedialog.cpp
settingspagebase.cpp
sidebarpage.cpp
- bookmarkssidebarpage.cpp
- infosidebarpage.cpp
statusbarspaceinfo.cpp
- renamedialog.cpp
- filterbar.cpp
- protocolcombo.cpp
- viewpropsprogressinfo.cpp
- applyviewpropsjob.cpp )
+ statusbarmessagelabel.cpp
+ undomanager.cpp
+ urlbutton.cpp
+ urlnavigator.cpp
+ urlnavigatorbutton.cpp
+ viewpropertiesdialog.cpp
+ viewproperties.cpp
+ viewsettingspage.cpp
+ viewpropsprogressinfo.cpp )
kde4_automoc(${dolphin_SRCS})
manager->save(false);
}
-void DolphinSettings::calculateGridSize(int hint)
-{
- // TODO: remove in KDE4
- const int previewSize = m_iconsModeSettings->previewSize();
- const int iconSize = m_iconsModeSettings->iconSize();
- const int maxSize = (previewSize > iconSize) ? previewSize : iconSize;
- const Q3IconView::Arrangement arrangement = (m_iconsModeSettings->arrangement() == "LeftToRight") ?
- Q3IconView::LeftToRight : Q3IconView::TopToBottom;
-
- int gridWidth = 0;
- int gridHeight = 0;
- if (arrangement == Q3IconView::LeftToRight) {
- int widthUnit = maxSize + (maxSize / 2);
- if (widthUnit < K3Icon::SizeLarge) {
- widthUnit = K3Icon::SizeLarge;
- }
-
- gridWidth = widthUnit + hint * K3Icon::SizeLarge;
-
- gridHeight = iconSize;
- if (gridHeight <= K3Icon::SizeMedium) {
- gridHeight = gridHeight * 2;
- }
- else {
- gridHeight += maxSize / 2;
- }
- }
- else {
- assert(arrangement == Q3IconView::TopToBottom);
- gridWidth = maxSize + (hint + 1) * (8 * m_iconsModeSettings->fontSize());
-
- // The height-setting is ignored yet by KFileIconView if the TopToBottom
- // arrangement is active. Anyway write the setting to have a defined value.
- gridHeight = maxSize;
- }
-
- m_iconsModeSettings->setGridWidth(gridWidth);
- m_iconsModeSettings->setGridHeight(gridHeight);
-}
-
-int DolphinSettings::textWidthHint() const
-{
- // TODO: remove in KDE4
- const int previewSize = m_iconsModeSettings->previewSize();
- const int iconSize = m_iconsModeSettings->iconSize();
- const Q3IconView::Arrangement arrangement = (m_iconsModeSettings->arrangement() == "LeftToRight") ?
- Q3IconView::LeftToRight : Q3IconView::TopToBottom;
-
- const int gridWidth = m_iconsModeSettings->gridWidth();
-
- const int maxSize = (previewSize > iconSize) ? previewSize : iconSize;
- int hint = 0;
- if (arrangement == Q3IconView::LeftToRight) {
- int widthUnit = maxSize + (maxSize / 2);
- if (widthUnit < K3Icon::SizeLarge) {
- widthUnit = K3Icon::SizeLarge;
- }
- hint = (gridWidth - widthUnit) / K3Icon::SizeLarge;
- }
- else {
- assert(arrangement == Q3IconView::TopToBottom);
- hint = (gridWidth - maxSize) / (8 * m_iconsModeSettings->fontSize()) - 1;
- if (hint > 2) {
- hint = 2;
- }
- }
- return hint;
-}
-
DolphinSettings::DolphinSettings()
{
m_generalSettings = new GeneralSettings();
/** @see DolphinSettingsBase::save */
virtual void save();
- /**
- * TODO: just temporary until the port to KDE4 has been done
- *
- * Calculates the width and the height of the grid dependant from \a hint and
- * the current settings. The hint gives information about the wanted text
- * width, where a lower value indicates a smaller text width. Currently
- * in Dolphin the values 0, 1 and 2 are used. See also
- * DolhinIconsViewSettings::textWidthHint.
- *
- * The calculation of the grid width and grid height is a little bit tricky,
- * as the user model does not fit to the implementation model of QIconView. The user model
- * allows to specify icon-, preview- and text width sizes, whereas the implementation
- * model expects only a grid width and height. The nasty thing is that the specified
- * width and height varies dependant from the arrangement (e. g. the height is totally
- * ignored for the top-to-bottom arrangement inside QIconView).
- */
- void calculateGridSize(int hint);
-
- /**
- * TODO: just temporary until the port to KDE4 has been done
- *
- * Returns the text width hint dependant from the given settings.
- * A lower value indicates a smaller text width. Currently
- * in Dolphin the values 0, 1 and 2 are used. The text width hint can
- * be used later for DolphinIconsViewSettings::calculateGridSize().
- */
- int textWidthHint() const;
-
protected:
DolphinSettings();
virtual ~DolphinSettings();
m_proxyModel = new DolphinSortFilterProxyModel(this);
m_proxyModel->setSourceModel(m_dirModel);
- m_iconsView->setModel(m_dirModel); // TODO: using m_proxyModel crashed when clicking on an item
+ m_iconsView->setModel(m_dirModel); // TODO: using m_proxyModel crashes when clicking on an item
KFileItemDelegate* delegate = new KFileItemDelegate(this);
+ delegate->setAdditionalInformation(KFileItemDelegate::FriendlyMimeType);
m_iconsView->setItemDelegate(delegate);
m_dirLister->setDelayedMimeTypes(true);
void DolphinView::applyModeToView()
{
- //m_iconsView->setAlternatingRowColors(true);
m_iconsView->setSelectionMode(QAbstractItemView::ExtendedSelection);
// TODO: the following code just tries to test some QListView capabilities
switch (m_mode) {
case IconsView:
m_iconsView->setViewMode(QListView::IconMode);
- m_iconsView->setGridSize(QSize(128, 64));
+ m_iconsView->setSpacing(32);
+ // m_iconsView->setAlternatingRowColors(false);
+ // m_iconsView->setGridSize(QSize(128, 64));
break;
case DetailsView:
m_iconsView->setViewMode(QListView::ListMode);
- m_iconsView->setGridSize(QSize(256, 24));
+ m_iconsView->setSpacing(0);
+ // m_iconsView->setAlternatingRowColors(true);
+ // m_iconsView->setGridSize(QSize(256, 24));
break;
}
}
<kcfg>
<kcfgfile name="dolphinrc"/>
<group name="General">
- <entry name="DefaultViewMode" type="Int">
- <label>Default view mode</label>
- <default>0</default>
- </entry>
<entry name="EditableUrl" type="Bool">
<label>Should the URL be editable for the user</label>
<default>false</default>
<label>Split the view into two panes</label>
<default>false</default>
</entry>
+ <entry name="globalViewProps" type="Bool">
+ <label>Should the view properties used for all directories</label>
+ <default>false</default>
+ </entry>
</group>
</kcfg>
\ No newline at end of file
vBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored);
// create 'Home Url' editor
- Q3GroupBox* homeGroup = new Q3GroupBox(1, Qt::Horizontal, i18n("Home Url"), vBox);
+ Q3GroupBox* homeGroup = new Q3GroupBox(1, Qt::Horizontal, i18n("Home Folder"), vBox);
homeGroup->setSizePolicy(sizePolicy);
homeGroup->setMargin(margin);
connect(useDefaultButton, SIGNAL(clicked()),
this, SLOT(useDefaulLocation()));
- // create 'Default View Mode' group
- Q3ButtonGroup* buttonGroup = new Q3ButtonGroup(3, Qt::Vertical, i18n("Default View Mode"), vBox);
- buttonGroup->setSizePolicy(sizePolicy);
- buttonGroup->setMargin(margin);
-
- m_iconsView = new QRadioButton(i18n("Icons"), buttonGroup);
- m_detailsView = new QRadioButton(i18n("Details"), buttonGroup);
-
- switch (settings->defaultViewMode()) {
- case DolphinView::IconsView: m_iconsView->setChecked(true); break;
- case DolphinView::DetailsView: m_detailsView->setChecked(true); break;
- }
+ QGroupBox* startBox = new QGroupBox(i18n("Start"), vBox);
// create 'Start with split view' checkbox
- m_startSplit = new QCheckBox(i18n("Start with split view"), vBox);
+ m_startSplit = new QCheckBox(i18n("Start with split view"), startBox);
m_startSplit->setChecked(settings->splitView());
// create 'Start with editable navigation bar' checkbox
- m_startEditable = new QCheckBox(i18n("Start with editable navigation bar"), vBox);
+ m_startEditable = new QCheckBox(i18n("Start with editable navigation bar"), startBox);
m_startEditable->setChecked(settings->editableUrl());
+ QVBoxLayout* startBoxLayout = new QVBoxLayout(startBox);
+ startBoxLayout->addWidget(m_startSplit);
+ startBoxLayout->addWidget(m_startEditable);
+
// Add a dummy widget with no restriction regarding
// a vertical resizing. This assures that the dialog layout
// is not stretched vertically.
settings->setHomeUrl(url.prettyUrl());
}
- const DolphinView::Mode viewMode = m_detailsView->isChecked() ?
- DolphinView::DetailsView :
- DolphinView::IconsView;
- settings->setDefaultViewMode(viewMode);
-
settings->setSplitView(m_startSplit->isChecked());
settings->setEditableUrl(m_startEditable->isChecked());
}
private:
DolphinMainWindow *m_mainWindow;
QLineEdit* m_homeUrl;
- QRadioButton* m_iconsView;
- QRadioButton* m_detailsView;
QCheckBox* m_startSplit;
QCheckBox* m_startEditable;
};
--- /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 "generalviewsettingspage.h"
+#include "dolphinsettings.h"
+#include "generalsettings.h"
+
+#include <assert.h>
+
+#include <QGroupBox>
+#include <QRadioButton>
+#include <QVBoxLayout>
+
+#include <kdialog.h>
+#include <klocale.h>
+#include <kvbox.h>
+
+GeneralViewSettingsPage::GeneralViewSettingsPage(QWidget* parent) :
+ KVBox(parent),
+ m_localProps(0),
+ m_globalProps(0)
+{
+ GeneralSettings* settings = DolphinSettings::instance().generalSettings();
+ assert(settings != 0);
+
+ const int spacing = KDialog::spacingHint();
+ const int margin = KDialog::marginHint();
+ const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
+
+ setSpacing(spacing);
+ setMargin(margin);
+
+ QGroupBox* propsBox = new QGroupBox(i18n("View Properties"), this);
+
+ m_localProps = new QRadioButton(i18n("Remember view properties for each folder."), propsBox);
+ m_globalProps = new QRadioButton(i18n("Use common view properties for all folders."), propsBox);
+ if (settings->globalViewProps()) {
+ m_globalProps->setChecked(true);
+ }
+ else {
+ m_localProps->setChecked(true);
+ }
+
+ QVBoxLayout* propsBoxLayout = new QVBoxLayout(propsBox);
+ propsBoxLayout->addWidget(m_localProps);
+ propsBoxLayout->addWidget(m_globalProps);
+
+ QGroupBox* previewBox = new QGroupBox(i18n("File Previews"), this);
+
+ // Add a dummy widget with no restriction regarding
+ // a vertical resizing. This assures that the dialog layout
+ // is not stretched vertically.
+ new QWidget(this);
+}
+
+
+GeneralViewSettingsPage::~GeneralViewSettingsPage()
+{
+}
+
+void GeneralViewSettingsPage::applySettings()
+{
+ GeneralSettings* settings = DolphinSettings::instance().generalSettings();
+ assert(settings != 0);
+ settings->setGlobalViewProps(m_globalProps->isChecked());
+}
+
+#include "generalviewsettingspage.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 GENERALVIEWSETTINGSPAGE_H
+#define GENERALVIEWSETTINGSPAGE_H
+
+#include <kvbox.h>
+
+class QRadioButton;
+
+/**
+ * @brief Represents the page from the Dolphin Settings which allows
+ * to modify general settings for the view modes.
+ *
+ * @author Peter Penz <peter.penz@gmx.at>
+ */
+class GeneralViewSettingsPage : public KVBox
+{
+ Q_OBJECT
+
+public:
+ GeneralViewSettingsPage(QWidget* parent);
+ virtual ~GeneralViewSettingsPage();
+
+ /**
+ * Applies the general settings for the view modes
+ * The settings are persisted automatically when
+ * closing Dolphin.
+ */
+ void applySettings();
+
+private:
+ QRadioButton* m_localProps;
+ QRadioButton* m_globalProps;
+};
+
+#endif
<label>Preview size</label>
<default code="true">K3Icon::SizeMedium</default>
</entry>
+ <entry name="AdditionalInfo" type="Int">
+ <label>Additional information</label>
+ <default>0</default>
+ </entry>
</group>
</kcfg>
\ No newline at end of file
m_iconSizeSlider(0),
m_previewSizeSlider(0),
m_textWidthBox(0),
- m_gridSpacingBox(0),
m_fontFamilyBox(0),
m_fontSizeBox(0),
m_textlinesCountBox(0),
- m_arrangementBox(0)
+ m_additionalInfo(0),
+ m_arrangementBox(0),
+ m_gridSpacingBox(0)
{
const int spacing = KDialog::spacingHint();
const int margin = KDialog::marginHint();
m_textWidthBox->addItem(i18n("Medium"));
m_textWidthBox->addItem(i18n("Large"));
+ new QLabel(i18n("Additional information:"), textGroup);
+ m_additionalInfo = new QComboBox(textGroup);
+ m_additionalInfo->addItem(i18n("No Information"));
+ m_additionalInfo->addItem(i18n("MIME Type"));
+ m_additionalInfo->addItem(i18n("Size"));
+ m_additionalInfo->addItem(i18n("Date"));
+ m_additionalInfo->setCurrentIndex(settings->additionalInfo());
+
Q3GroupBox* gridGroup = new Q3GroupBox(2, Qt::Horizontal, i18n("Grid"), this);
gridGroup->setSizePolicy(sizePolicy);
gridGroup->setMargin(margin);
"LeftToRight" :
"TopToBottom";
settings->setArrangement(arrangement);
- DolphinSettings::instance().calculateGridSize(m_textWidthBox->currentIndex());
+ //DolphinSettings::instance().calculateGridSize(m_textWidthBox->currentIndex());
settings->setFontFamily(m_fontFamilyBox->currentFont().family());
settings->setFontSize(fontSize);
{
IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
assert(settings != 0);
- m_textWidthBox->setCurrentIndex(DolphinSettings::instance().textWidthHint());
+ //m_textWidthBox->setCurrentIndex(DolphinSettings::instance().textWidthHint());
}
#include "iconsviewsettingspage.moc"
QSlider* m_previewSizeSlider;
PixmapViewer* m_previewSizeViewer;
QComboBox* m_textWidthBox;
- QComboBox* m_gridSpacingBox;
QFontComboBox* m_fontFamilyBox;
QSpinBox* m_fontSizeBox;
QSpinBox* m_textlinesCountBox;
+ QComboBox* m_additionalInfo;
+
QComboBox* m_arrangementBox;
+ QComboBox* m_gridSpacingBox;
/** Returns the icon size for the given slider value. */
int iconSize(int sliderValue) const;
m_sortOrder(0),
m_showPreview(0),
m_showHiddenFiles(0),
- m_applyToSubFolders(0)
+ m_applyToSubFolders(0),
+ m_useAsDefault(0)
{
assert(dolphinView != 0);
propsBoxLayout->addWidget(m_showHiddenFiles, 4, 0);
m_applyToSubFolders = new QCheckBox(i18n("Apply changes to all sub folders"), main);
+ m_useAsDefault = new QCheckBox(i18n("Use as default"), main);
+
topLayout->addWidget(propsBox);
topLayout->addWidget(m_applyToSubFolders);
+ topLayout->addWidget(m_useAsDefault);
connect(m_viewMode, SIGNAL(activated(int)),
this, SLOT(slotViewModeChanged(int)));
connect(m_showHiddenFiles, SIGNAL(clicked()),
this, SLOT(slotShowHiddenFilesChanged()));
+ connect(m_applyToSubFolders, SIGNAL(clicked()),
+ this, SLOT(markAsDirty()));
connect(m_applyToSubFolders, SIGNAL(clicked()),
this, SLOT(markAsDirty()));
m_viewProps->save();
m_dolphinView->setViewProperties(*m_viewProps);
m_isDirty = false;
+
+ // TODO: handle m_useAsDefault setting
}
#include "viewpropertiesdialog.moc"
QCheckBox* m_showPreview;
QCheckBox* m_showHiddenFiles;
QCheckBox* m_applyToSubFolders;
+ QCheckBox* m_useAsDefault;
void applyViewProperties();
};
***************************************************************************/
#include "viewsettingspage.h"
-#include <qtabwidget.h>
-#include <qlayout.h>
-#include <qlabel.h>
-//Added by qt3to4:
+#include "generalviewsettingspage.h"
+#include "iconsviewsettingspage.h"
+#include "detailsviewsettingspage.h"
+
#include <Q3VBoxLayout>
+#include <QTabWidget>
+#include <QLayout>
+#include <QLabel>
+
#include <kdialog.h>
#include <klocale.h>
#include <kiconloader.h>
-#include "iconsviewsettingspage.h"
-#include "detailsviewsettingspage.h"
ViewSettingsPage::ViewSettingsPage(QWidget *parent) :
SettingsPageBase(parent),
+ m_generalPage(0),
m_iconsPage(0),
m_detailsPage(0)
{
QTabWidget* tabWidget = new QTabWidget(this);
+ // initialize 'General' tab
+ m_generalPage = new GeneralViewSettingsPage(tabWidget);
+ tabWidget->addTab(m_generalPage, SmallIcon("view_choose"), i18n("General"));
+
// initialize 'Icons' tab
m_iconsPage = new IconsViewSettingsPage(tabWidget);
tabWidget->addTab(m_iconsPage, SmallIcon("view_icon"), i18n("Icons"));
void ViewSettingsPage::applySettings()
{
+ m_generalPage->applySettings();
m_iconsPage->applySettings();
m_detailsPage->applySettings();
}
#include <qwidget.h>
#include <settingspagebase.h>
+class GeneralViewSettingsPage;
class IconsViewSettingsPage;
class DetailsViewSettingsPage;
/**
* @brief Page for the 'View' settings of the Dolphin settings dialog.
*
- * The views settings allow to set the properties for the icons mode,
- * the details mode and the previews mode.
+ * The views settings allow to set the properties for the icons mode and
+ * the details mode.
*
* @author Peter Penz <peter.penz@gmx.at>
*/
virtual void applySettings();
private:
+ GeneralViewSettingsPage* m_generalPage;
IconsViewSettingsPage* m_iconsPage;
DetailsViewSettingsPage* m_detailsPage;
};