diff options
| author | Peter Penz <[email protected]> | 2007-10-30 20:52:03 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-10-30 20:52:03 +0000 |
| commit | 496872dddcd6f50ba8addaf16b6b0d5c8f52bc71 (patch) | |
| tree | d467370b68fb8c003e82badc33531741d419b2c6 /src/additionalinfodialog.cpp | |
| parent | d9f5e191a6bd32a4dc15b3a3eb34795cda7697dd (diff) | |
allow to configure the additional information of the view inside the viewproperties dialog
svn path=/trunk/KDE/kdebase/apps/; revision=731150
Diffstat (limited to 'src/additionalinfodialog.cpp')
| -rw-r--r-- | src/additionalinfodialog.cpp | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/src/additionalinfodialog.cpp b/src/additionalinfodialog.cpp new file mode 100644 index 000000000..9d3e91901 --- /dev/null +++ b/src/additionalinfodialog.cpp @@ -0,0 +1,104 @@ +/*************************************************************************** + * Copyright (C) 2007 by Peter Penz ([email protected]) * + * * + * 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 "additionalinfodialog.h" + +#include <klocale.h> +#include <kvbox.h> + +#include <QCheckBox> + +AdditionalInfoDialog::AdditionalInfoDialog(QWidget* parent, + KFileItemDelegate::InformationList info) : + KDialog(parent), + m_info(info), + m_size(0), + m_date(0), + m_permissions(0), + m_owner(0), + m_group(0), + m_type(0) +{ + setCaption(i18nc("@title:window", "Additional Information")); + setButtons(Ok | Cancel); + setDefaultButton(Ok); + + KVBox* box = new KVBox(this); + + m_size = new QCheckBox(i18nc("@option:check Additional Information", "Size"), box); + m_date = new QCheckBox(i18nc("@option:check Additional Information", "Date"), box); + m_permissions = new QCheckBox(i18nc("@option:check Additional Information", "Permissions"), box); + m_owner = new QCheckBox(i18nc("@option:check Additional Information", "Owner"), box); + m_group = new QCheckBox(i18nc("@option:check Additional Information", "Group"), box); + m_type = new QCheckBox(i18nc("@option:check Additional Information", "Type"), box); + connect(this, SIGNAL(okClicked()), this, SLOT(slotOk())); + + m_size->setChecked(info.contains(KFileItemDelegate::Size)); + m_date->setChecked(info.contains(KFileItemDelegate::ModificationTime)); + m_permissions->setChecked(info.contains(KFileItemDelegate::Permissions)); + m_owner->setChecked(info.contains(KFileItemDelegate::Owner)); + m_group->setChecked(info.contains(KFileItemDelegate::OwnerAndGroup)); + m_type->setChecked(info.contains(KFileItemDelegate::FriendlyMimeType)); + + setMainWidget(box); + + const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), + "AdditionalInfoDialog"); + restoreDialogSize(dialogConfig); + +} + +AdditionalInfoDialog::~AdditionalInfoDialog() +{ + KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), + "AdditionalInfoDialog"); + saveDialogSize(dialogConfig, KConfigBase::Persistent); + +} + +KFileItemDelegate::InformationList AdditionalInfoDialog::additionalInfo() const +{ + return m_info; +} + +void AdditionalInfoDialog::slotOk() +{ + m_info.clear(); + + if (m_size->isChecked()) { + m_info.append(KFileItemDelegate::Size); + } + if (m_date->isChecked()) { + m_info.append(KFileItemDelegate::ModificationTime); + } + if (m_permissions->isChecked()) { + m_info.append(KFileItemDelegate::Permissions); + } + if (m_owner->isChecked()) { + m_info.append(KFileItemDelegate::Owner); + } + if (m_group->isChecked()) { + m_info.append(KFileItemDelegate::OwnerAndGroup); + } + if (m_type->isChecked()) { + m_info.append(KFileItemDelegate::FriendlyMimeType); + } +} + +#include "additionalinfodialog.moc" |
