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
#include <kglobalsettings.h>
#include <kfilemetainfo.h>
#include <kiconeffect.h>
+#include <kmenu.h>
#include <kseparator.h>
#include <kiconloader.h>
#include <QVBoxLayout>
#include "settings/dolphinsettings.h"
+#include "informationpaneldialog.h"
#include "metadatawidget.h"
#include "metatextlabel.h"
#include "phononwidget.h"
m_phononWidget(0),
m_metaDataWidget(0),
m_metaTextArea(0),
- m_metaTextLabel(0)
+ m_metaTextLabel(0),
+ m_dialog(0)
{
}
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()) {
#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.
/** @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
QScrollArea* m_metaTextArea;
MetaTextLabel* m_metaTextLabel;
+
+ QPointer<InformationPanelDialog> m_dialog;
};
#endif // INFORMATIONPANEL_H
--- /dev/null
+/***************************************************************************
+ * 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"
--- /dev/null
+/***************************************************************************
+ * 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