mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-17 15:31:20 +00:00
added dialog to configure which meta data should be shown in the Information Panel
svn path=/trunk/KDE/kdebase/apps/; revision=934828
This commit is contained in:
parent
3fa4d31152
commit
aed1525abc
|
@ -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
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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
|
||||
|
|
83
src/panels/information/informationpaneldialog.cpp
Normal file
83
src/panels/information/informationpaneldialog.cpp
Normal file
|
@ -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"
|
48
src/panels/information/informationpaneldialog.h
Normal file
48
src/panels/information/informationpaneldialog.h
Normal file
|
@ -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
|
Loading…
Reference in a new issue