]> cloud.milkyroute.net Git - dolphin.git/commitdiff
added dialog to configure which meta data should be shown in the Information Panel
authorPeter Penz <peter.penz19@gmail.com>
Tue, 3 Mar 2009 21:17:35 +0000 (21:17 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Tue, 3 Mar 2009 21:17:35 +0000 (21:17 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=934828

src/CMakeLists.txt
src/panels/information/informationpanel.cpp
src/panels/information/informationpanel.h
src/panels/information/informationpaneldialog.cpp [new file with mode: 0644]
src/panels/information/informationpaneldialog.h [new file with mode: 0644]

index c1daf5e8b9c3d783b21d716be754cfee97dabb99..d6cc3e7550a0572cca0d30f4dad509280d126202 100644 (file)
@@ -102,6 +102,7 @@ set(dolphin_SRCS
     panels/information/commentwidget.cpp
     panels/information/commenteditwidget.cpp
     panels/information/informationpanel.cpp
+    panels/information/informationpaneldialog.cpp
     panels/information/metadatawidget.cpp
     panels/information/metatextlabel.cpp
     panels/information/phononwidget.cpp
index c586742cf88e404d08c74aa996e6f22345ec2a28..2f395a4c49b50be4b9c78a692735567226740408 100644 (file)
@@ -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()) {
index 997ba69bf65ac24fa4267458f30c6b81ee675495..bc37f812ae4a3dde7e085c2c0042ed1f3328e30f 100644 (file)
 #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 (file)
index 0000000..0922197
--- /dev/null
@@ -0,0 +1,83 @@
+/***************************************************************************
+ *   Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at>                  *
+ *                                                                         *
+ *   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 (file)
index 0000000..8ed5327
--- /dev/null
@@ -0,0 +1,48 @@
+/***************************************************************************
+ *   Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at>                  *
+ *                                                                         *
+ *   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