delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / apps / dolphin / src / settings / additionalinfodialog.cpp
blob2f735fffec6afd20b5661b2f7bc446ac2486b0e7
1 /***************************************************************************
2 * Copyright (C) 2007 by Peter Penz (peter.penz@gmx.at) *
3 * *
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. *
8 * *
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. *
13 * *
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 "additionalinfodialog.h"
22 #include <klocale.h>
23 #include <kvbox.h>
25 #include <QCheckBox>
27 AdditionalInfoDialog::AdditionalInfoDialog(QWidget* parent,
28 KFileItemDelegate::InformationList info) :
29 KDialog(parent),
30 m_info(info),
31 m_size(0),
32 m_date(0),
33 m_permissions(0),
34 m_owner(0),
35 m_group(0),
36 m_type(0)
38 setCaption(i18nc("@title:window", "Additional Information"));
39 setButtons(Ok | Cancel);
40 setDefaultButton(Ok);
42 KVBox* box = new KVBox(this);
44 m_size = new QCheckBox(i18nc("@option:check Additional Information", "Size"), box);
45 m_date = new QCheckBox(i18nc("@option:check Additional Information", "Date"), box);
46 m_permissions = new QCheckBox(i18nc("@option:check Additional Information", "Permissions"), box);
47 m_owner = new QCheckBox(i18nc("@option:check Additional Information", "Owner"), box);
48 m_group = new QCheckBox(i18nc("@option:check Additional Information", "Group"), box);
49 m_type = new QCheckBox(i18nc("@option:check Additional Information", "Type"), box);
50 connect(this, SIGNAL(okClicked()), this, SLOT(slotOk()));
52 m_size->setChecked(info.contains(KFileItemDelegate::Size));
53 m_date->setChecked(info.contains(KFileItemDelegate::ModificationTime));
54 m_permissions->setChecked(info.contains(KFileItemDelegate::Permissions));
55 m_owner->setChecked(info.contains(KFileItemDelegate::Owner));
56 m_group->setChecked(info.contains(KFileItemDelegate::OwnerAndGroup));
57 m_type->setChecked(info.contains(KFileItemDelegate::FriendlyMimeType));
59 setMainWidget(box);
61 const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"),
62 "AdditionalInfoDialog");
63 restoreDialogSize(dialogConfig);
66 AdditionalInfoDialog::~AdditionalInfoDialog()
68 KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"),
69 "AdditionalInfoDialog");
70 saveDialogSize(dialogConfig, KConfigBase::Persistent);
73 KFileItemDelegate::InformationList AdditionalInfoDialog::additionalInfo() const
75 return m_info;
78 void AdditionalInfoDialog::slotOk()
80 m_info.clear();
82 if (m_size->isChecked()) {
83 m_info.append(KFileItemDelegate::Size);
85 if (m_date->isChecked()) {
86 m_info.append(KFileItemDelegate::ModificationTime);
88 if (m_permissions->isChecked()) {
89 m_info.append(KFileItemDelegate::Permissions);
91 if (m_owner->isChecked()) {
92 m_info.append(KFileItemDelegate::Owner);
94 if (m_group->isChecked()) {
95 m_info.append(KFileItemDelegate::OwnerAndGroup);
97 if (m_type->isChecked()) {
98 m_info.append(KFileItemDelegate::FriendlyMimeType);
102 #include "additionalinfodialog.moc"