]>
cloud.milkyroute.net Git - dolphin.git/blob - src/generalviewsettingspage.cpp
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
21 #include "generalviewsettingspage.h"
22 #include "dolphinmainwindow.h"
23 #include "dolphinsettings.h"
24 #include "generalsettings.h"
25 #include "viewproperties.h"
30 #include <QRadioButton>
31 #include <QVBoxLayout>
37 GeneralViewSettingsPage::GeneralViewSettingsPage(DolphinMainWindow
* mainWindow
,
40 m_mainWindow(mainWindow
),
44 GeneralSettings
* settings
= DolphinSettings::instance().generalSettings();
45 assert(settings
!= 0);
47 const int spacing
= KDialog::spacingHint();
48 const int margin
= KDialog::marginHint();
49 const QSizePolicy
sizePolicy(QSizePolicy::Preferred
, QSizePolicy::Fixed
);
54 QGroupBox
* propsBox
= new QGroupBox(i18n("View Properties"), this);
56 m_localProps
= new QRadioButton(i18n("Remember view properties for each folder."), propsBox
);
57 m_globalProps
= new QRadioButton(i18n("Use common view properties for all folders."), propsBox
);
58 if (settings
->globalViewProps()) {
59 m_globalProps
->setChecked(true);
62 m_localProps
->setChecked(true);
65 QVBoxLayout
* propsBoxLayout
= new QVBoxLayout(propsBox
);
66 propsBoxLayout
->addWidget(m_localProps
);
67 propsBoxLayout
->addWidget(m_globalProps
);
69 QGroupBox
* previewBox
= new QGroupBox(i18n("File Previews"), this);
71 // Add a dummy widget with no restriction regarding
72 // a vertical resizing. This assures that the dialog layout
73 // is not stretched vertically.
78 GeneralViewSettingsPage::~GeneralViewSettingsPage()
82 void GeneralViewSettingsPage::applySettings()
84 const KUrl
& url
= m_mainWindow
->activeView()->url();
85 ViewProperties
props(url
); // read current view properties
87 const bool useGlobalProps
= m_globalProps
->isChecked();
89 GeneralSettings
* settings
= DolphinSettings::instance().generalSettings();
90 assert(settings
!= 0);
91 settings
->setGlobalViewProps(useGlobalProps
);
94 // Remember the global view properties by applying the current view properties.
95 // It is important that GeneralSettings::globalViewProps() is set before
96 // the class ViewProperties is used, as ViewProperties uses this setting
97 // to find the destination folder for storing the view properties.
98 ViewProperties
globalProps(url
);
99 globalProps
.setDirProperties(props
);
103 #include "generalviewsettingspage.moc"