]>
cloud.milkyroute.net Git - dolphin.git/blob - src/settings/navigation/navigationsettingspage.cpp
e37a35d8eb9e6141319243338882e254c4f5518f
1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz19@gmail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #include "navigationsettingspage.h"
22 #include "dolphin_generalsettings.h"
24 #include <KLocalizedString>
27 #include <QVBoxLayout>
29 NavigationSettingsPage::NavigationSettingsPage(QWidget
* parent
) :
30 SettingsPageBase(parent
),
31 m_openArchivesAsFolder(0),
32 m_autoExpandFolders(0)
34 QVBoxLayout
* topLayout
= new QVBoxLayout(this);
35 QWidget
* vBox
= new QWidget(this);
36 QVBoxLayout
*vBoxLayout
= new QVBoxLayout(vBox
);
37 vBoxLayout
->setMargin(0);
38 vBoxLayout
->setAlignment(Qt::AlignTop
);
40 m_openArchivesAsFolder
= new QCheckBox(i18nc("@option:check", "Open archives as folder"), vBox
);
41 vBoxLayout
->addWidget(m_openArchivesAsFolder
);
43 m_autoExpandFolders
= new QCheckBox(i18nc("option:check", "Open folders during drag operations"), vBox
);
44 vBoxLayout
->addWidget(m_autoExpandFolders
);
46 topLayout
->addWidget(vBox
);
50 connect(m_openArchivesAsFolder
, &QCheckBox::toggled
, this, &NavigationSettingsPage::changed
);
51 connect(m_autoExpandFolders
, &QCheckBox::toggled
, this, &NavigationSettingsPage::changed
);
54 NavigationSettingsPage::~NavigationSettingsPage()
58 void NavigationSettingsPage::applySettings()
60 GeneralSettings
* settings
= GeneralSettings::self();
61 settings
->setBrowseThroughArchives(m_openArchivesAsFolder
->isChecked());
62 settings
->setAutoExpandFolders(m_autoExpandFolders
->isChecked());
67 void NavigationSettingsPage::restoreDefaults()
69 GeneralSettings
* settings
= GeneralSettings::self();
70 settings
->useDefaults(true);
72 settings
->useDefaults(false);
75 void NavigationSettingsPage::loadSettings()
77 m_openArchivesAsFolder
->setChecked(GeneralSettings::browseThroughArchives());
78 m_autoExpandFolders
->setChecked(GeneralSettings::autoExpandFolders());