diff options
| author | Peter Penz <[email protected]> | 2009-10-16 15:50:30 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2009-10-16 15:50:30 +0000 |
| commit | 0bd6e46b2b274be3b9cd9c3759b771abf04a6eb9 (patch) | |
| tree | 64ae04d10f49d3420b51bb3fc56438f18d315f42 /src | |
| parent | a6355d1ca42ae6ff57da81dbc1a3b097fbc333ca (diff) | |
prepare the behavior-settings dialog to configure the shown meta data for tooltips
svn path=/trunk/KDE/kdebase/apps/; revision=1036100
Diffstat (limited to 'src')
| -rw-r--r-- | src/panels/information/metadataconfigurationdialog.cpp | 5 | ||||
| -rw-r--r-- | src/panels/information/metadataconfigurationdialog.h | 8 | ||||
| -rw-r--r-- | src/settings/behaviorsettingspage.cpp | 42 | ||||
| -rw-r--r-- | src/settings/behaviorsettingspage.h | 15 |
4 files changed, 69 insertions, 1 deletions
diff --git a/src/panels/information/metadataconfigurationdialog.cpp b/src/panels/information/metadataconfigurationdialog.cpp index a725e976f..f3bb929da 100644 --- a/src/panels/information/metadataconfigurationdialog.cpp +++ b/src/panels/information/metadataconfigurationdialog.cpp @@ -92,6 +92,11 @@ void MetaDataConfigurationDialog::Private::loadMetaData() #ifdef HAVE_NEPOMUK // Get all meta information labels that are available for // the currently shown file item and add them to the list. + if (m_url.isEmpty()) { + // TODO: in this case all available meta data from the system + // should be added. + return; + } Nepomuk::Resource res(m_url); QHash<QUrl, Nepomuk::Variant> properties = res.properties(); QHash<QUrl, Nepomuk::Variant>::const_iterator it = properties.constBegin(); diff --git a/src/panels/information/metadataconfigurationdialog.h b/src/panels/information/metadataconfigurationdialog.h index 18f0ecde6..9dda9c190 100644 --- a/src/panels/information/metadataconfigurationdialog.h +++ b/src/panels/information/metadataconfigurationdialog.h @@ -30,9 +30,17 @@ class MetaDataConfigurationDialog : public KDialog Q_OBJECT public: + /** + * @param url URL for which should be configured what kind of meta data is + * shown. If the URL is empty, the configuration dialog will contain + * all available meta data from the system. + * @param parent Parent widget which opens the dialog. + * @param flags Window flags for the dialog. + */ MetaDataConfigurationDialog(const KUrl& url, QWidget* parent = 0, Qt::WFlags flags = 0); + virtual ~MetaDataConfigurationDialog(); protected slots: diff --git a/src/settings/behaviorsettingspage.cpp b/src/settings/behaviorsettingspage.cpp index 0965b3e22..80afd04f5 100644 --- a/src/settings/behaviorsettingspage.cpp +++ b/src/settings/behaviorsettingspage.cpp @@ -23,6 +23,9 @@ #include "dolphinsettings.h" #include "dolphin_generalsettings.h" +// TODO: +// #include "nepomuk/metadataconfigurationdialog.h" + #include <viewproperties.h> #include <kdialog.h> @@ -31,6 +34,7 @@ #include <QCheckBox> #include <QGroupBox> +#include <QHBoxLayout> #include <QLabel> #include <QRadioButton> #include <QVBoxLayout> @@ -47,6 +51,7 @@ BehaviorSettingsPage::BehaviorSettingsPage(const KUrl& url, QWidget* parent) : m_confirmDelete(0), m_renameInline(0), m_showToolTips(0), + m_configureToolTips(0), m_showSelectionToggle(0), m_naturalSorting(0) { @@ -88,15 +93,30 @@ BehaviorSettingsPage::BehaviorSettingsPage(const KUrl& url, QWidget* parent) : confirmBoxLayout->addWidget(m_confirmDelete); confirmBoxLayout->addWidget(m_confirmClosingMultipleTabs); + // 'Rename inline' m_renameInline = new QCheckBox(i18nc("@option:check", "Rename inline"), vBox); connect(m_renameInline, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - m_showToolTips = new QCheckBox(i18nc("@option:check", "Show tooltips"), vBox); + // 'Show tooltips' + QWidget* toolTipContainer = new QWidget(vBox); + QHBoxLayout* toolTipsLayout = new QHBoxLayout(toolTipContainer); + toolTipsLayout->setMargin(0); + m_showToolTips = new QCheckBox(i18nc("@option:check", "Show tooltips"), toolTipContainer); connect(m_showToolTips, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + connect(m_showToolTips, SIGNAL(toggled(bool)), this, SLOT(updateConfigureButton())); + + m_configureToolTips = new QLabel(toolTipContainer); + connect(m_configureToolTips, SIGNAL(linkActivated(const QString&)), + this, SLOT(configureToolTips(const QString&))); + + toolTipsLayout->addWidget(m_showToolTips); + toolTipsLayout->addWidget(m_configureToolTips, 1, Qt::AlignLeft); + // 'Show selection marker' m_showSelectionToggle = new QCheckBox(i18nc("@option:check", "Show selection marker"), vBox); connect(m_showSelectionToggle, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + // 'Natural sorting of items' m_naturalSorting = new QCheckBox(i18nc("option:check", "Natural sorting of items"), vBox); connect(m_naturalSorting, SIGNAL(toggled(bool)), this, SIGNAL(changed())); @@ -162,6 +182,24 @@ void BehaviorSettingsPage::restoreDefaults() m_confirmDelete->setChecked(CONFIRM_DELETE); } +void BehaviorSettingsPage::updateConfigureButton() +{ + if (m_showToolTips->isChecked()) { + m_configureToolTips->setText("<a href=\"configure\">" + + i18nc("@action:button", "Configure...") + + "</a>"); + } else { + m_configureToolTips->setText(QString()); + } +} + +void BehaviorSettingsPage::configureToolTips() +{ + // TODO: + //MetaDataConfigurationDialog dialog(KUrl(), this, Qt::Dialog); + //dialog.exec(); +} + void BehaviorSettingsPage::loadSettings() { GeneralSettings* settings = DolphinSettings::instance().generalSettings(); @@ -181,6 +219,8 @@ void BehaviorSettingsPage::loadSettings() m_showToolTips->setChecked(settings->showToolTips()); m_showSelectionToggle->setChecked(settings->showSelectionToggle()); m_naturalSorting->setChecked(KGlobalSettings::naturalSorting()); + + updateConfigureButton(); } #include "behaviorsettingspage.moc" diff --git a/src/settings/behaviorsettingspage.h b/src/settings/behaviorsettingspage.h index 292a79576..331e45806 100644 --- a/src/settings/behaviorsettingspage.h +++ b/src/settings/behaviorsettingspage.h @@ -24,6 +24,7 @@ #include <kurl.h> class QCheckBox; +class QLabel; class QRadioButton; /** @@ -43,6 +44,19 @@ public: /** @see SettingsPageBase::restoreDefaults() */ virtual void restoreDefaults(); +private slots: + /** + * Updates the visibility state of the configure + * button m_configureToolTips. + */ + void updateConfigureButton(); + + /** + * Opens a dialog which allows the user to specify which + * meta data should be shown in the tooltip. + */ + void configureToolTips(); + private: void loadSettings(); @@ -58,6 +72,7 @@ private: QCheckBox* m_renameInline; QCheckBox* m_showToolTips; + QLabel* m_configureToolTips; QCheckBox* m_showSelectionToggle; QCheckBox* m_naturalSorting; }; |
