┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels
diff options
context:
space:
mode:
Diffstat (limited to 'src/panels')
-rw-r--r--src/panels/information/informationpanel.cpp22
-rw-r--r--src/panels/information/informationpanel.h26
-rw-r--r--src/panels/information/informationpaneldialog.cpp83
-rw-r--r--src/panels/information/informationpaneldialog.h48
4 files changed, 169 insertions, 10 deletions
diff --git a/src/panels/information/informationpanel.cpp b/src/panels/information/informationpanel.cpp
index c586742cf..2f395a4c4 100644
--- a/src/panels/information/informationpanel.cpp
+++ b/src/panels/information/informationpanel.cpp
@@ -31,6 +31,7 @@
#include <kglobalsettings.h>
#include <kfilemetainfo.h>
#include <kiconeffect.h>
+#include <kmenu.h>
#include <kseparator.h>
#include <kiconloader.h>
@@ -58,6 +59,7 @@
#include <QVBoxLayout>
#include "settings/dolphinsettings.h"
+#include "informationpaneldialog.h"
#include "metadatawidget.h"
#include "metatextlabel.h"
#include "phononwidget.h"
@@ -78,7 +80,8 @@ InformationPanel::InformationPanel(QWidget* parent) :
m_phononWidget(0),
m_metaDataWidget(0),
m_metaTextArea(0),
- m_metaTextLabel(0)
+ m_metaTextLabel(0),
+ m_dialog(0)
{
}
@@ -207,6 +210,23 @@ bool InformationPanel::eventFilter(QObject* obj, QEvent* event)
return Panel::eventFilter(obj, event);
}
+void InformationPanel::contextMenuEvent(QContextMenuEvent* event)
+{
+ Panel::contextMenuEvent(event);
+
+ KMenu popup(this);
+ popup.addAction(i18nc("@action:inmenu", "Configure..."));
+ if (popup.exec(QCursor::pos()) != 0) {
+ if (m_dialog == 0) {
+ m_dialog = new InformationPanelDialog(this);
+ m_dialog->setAttribute(Qt::WA_DeleteOnClose);
+ m_dialog->show();
+ } else {
+ m_dialog->raise();
+ }
+ }
+}
+
void InformationPanel::showItemInfo()
{
if (!isVisible()) {
diff --git a/src/panels/information/informationpanel.h b/src/panels/information/informationpanel.h
index 997ba69bf..bc37f812a 100644
--- a/src/panels/information/informationpanel.h
+++ b/src/panels/information/informationpanel.h
@@ -21,27 +21,30 @@
#define INFORMATIONPANEL_H
#include <panels/panel.h>
+#include <panels/information/informationpaneldialog.h>
-#include <QtGui/QPushButton>
-#include <QtGui/QPixmap>
-#include <QtCore/QEvent>
-#include <QtGui/QLabel>
-#include <QtCore/QList>
+#include <QPushButton>
+#include <QPixmap>
+#include <QEvent>
+#include <QLabel>
+#include <QList>
+#include <QPointer>
#include <kurl.h>
#include <kmimetype.h>
#include <kdesktopfileactions.h>
#include <kvbox.h>
+class InformationPanelDialog;
+class PhononWidget;
+class PixmapViewer;
+class MetaDataWidget;
+class MetaTextLabel;
class QPixmap;
class QString;
class KFileItem;
class QLabel;
class QScrollArea;
-class PhononWidget;
-class PixmapViewer;
-class MetaDataWidget;
-class MetaTextLabel;
/**
* @brief Panel for showing meta information of one ore more selected items.
@@ -85,6 +88,9 @@ protected:
/** @see QObject::eventFilter() */
virtual bool eventFilter(QObject* obj, QEvent* event);
+ /** @see QWidget::contextMenuEvent() */
+ virtual void contextMenuEvent(QContextMenuEvent* event);
+
private slots:
/**
* Shows the information for the item of the URL which has been provided by
@@ -196,6 +202,8 @@ private:
QScrollArea* m_metaTextArea;
MetaTextLabel* m_metaTextLabel;
+
+ QPointer<InformationPanelDialog> m_dialog;
};
#endif // INFORMATIONPANEL_H
diff --git a/src/panels/information/informationpaneldialog.cpp b/src/panels/information/informationpaneldialog.cpp
new file mode 100644
index 000000000..0922197aa
--- /dev/null
+++ b/src/panels/information/informationpaneldialog.cpp
@@ -0,0 +1,83 @@
+/***************************************************************************
+ * Copyright (C) 2009 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 "informationpaneldialog.h"
+
+#include <klocale.h>
+#include <kiconloader.h>
+
+#include <QVBoxLayout>
+
+InformationPanelDialog::InformationPanelDialog(QWidget* parent) :
+ KDialog(parent),
+ m_isDirty(false)
+{
+ setCaption(i18nc("@title:window", "Information Panel"));
+ setButtons(KDialog::Ok | KDialog::Cancel | KDialog::Apply);
+
+ QWidget* main = new QWidget();
+ // ...
+ Q_UNUSED(main);
+ QVBoxLayout* topLayout = new QVBoxLayout();
+ // ...
+ Q_UNUSED(topLayout);
+
+ connect(this, SIGNAL(okClicked()), this, SLOT(slotOk()));
+ connect(this, SIGNAL(applyClicked()), this, SLOT(slotApply()));
+
+ main->setLayout(topLayout);
+ setMainWidget(main);
+
+ const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"),
+ "InformationPanelDialog");
+ restoreDialogSize(dialogConfig);
+
+ loadSettings();
+}
+
+InformationPanelDialog::~InformationPanelDialog()
+{
+ KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"),
+ "InformationPanelDialog");
+ saveDialogSize(dialogConfig, KConfigBase::Persistent);
+}
+
+void InformationPanelDialog::slotOk()
+{
+ // ...
+ accept();
+}
+
+void InformationPanelDialog::slotApply()
+{
+ // ...
+ markAsDirty(false);
+}
+
+void InformationPanelDialog::markAsDirty(bool isDirty)
+{
+ m_isDirty = isDirty;
+ enableButtonApply(isDirty);
+}
+
+void InformationPanelDialog::loadSettings()
+{
+}
+
+#include "informationpaneldialog.moc"
diff --git a/src/panels/information/informationpaneldialog.h b/src/panels/information/informationpaneldialog.h
new file mode 100644
index 000000000..8ed5327ff
--- /dev/null
+++ b/src/panels/information/informationpaneldialog.h
@@ -0,0 +1,48 @@
+/***************************************************************************
+ * Copyright (C) 2009 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 *
+ ***************************************************************************/
+
+#ifndef INFORMATIONPANELDIALOG_H
+#define INFORMATIONPANELDIALOG_H
+
+#include <kdialog.h>
+
+/**
+ * @brief Dialog for adjusting the Information Panel settings.
+ */
+class InformationPanelDialog : public KDialog
+{
+ Q_OBJECT
+
+public:
+ explicit InformationPanelDialog(QWidget* parent);
+ virtual ~InformationPanelDialog();
+
+private slots:
+ void slotOk();
+ void slotApply();
+ void markAsDirty(bool isDirty);
+
+private:
+ void loadSettings();
+
+private:
+ bool m_isDirty;
+};
+
+#endif