pixmapviewer.cpp
panels/information/informationpanel.cpp
panels/information/informationpanelcontent.cpp
- panels/information/metadatawidget.cpp
- panels/information/metadataconfigurationdialog.cpp
+ panels/information/kmetadatawidget.cpp
+ panels/information/kmetadataconfigurationdialog.cpp
panels/information/phononwidget.cpp
panels/folders/ktreeview.cpp
panels/places/placespanel.cpp
if(Nepomuk_FOUND)
set(dolphin_SRCS
${dolphin_SRCS}
- panels/information/commentwidget.cpp
- panels/information/edittagsdialog.cpp
+ panels/information/kcommentwidget.cpp
+ panels/information/kedittagsdialog.cpp
panels/information/nepomukmassupdatejob.cpp
- panels/information/taggingwidget.cpp
+ panels/information/ktaggingwidget.cpp
)
endif(Nepomuk_FOUND)
#include "panels/folders/folderspanel.h"
#include "panels/places/placespanel.h"
#include "panels/information/informationpanel.h"
-#include "panels/information/metadatawidget.h"
#include "mainwindowadaptor.h"
#include "statusbar/dolphinstatusbar.h"
#include "viewproperties.h"
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org> *
- * 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 COMMENT_WIDGET
-#define COMMENT_WIDGET
-
-#include <QString>
-#include <QWidget>
-
-class QLabel;
-
-class CommentWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- CommentWidget(QWidget* parent);
- virtual ~CommentWidget();
-
- void setText(const QString& comment);
- QString text() const;
-
-signals:
- void commentChanged(const QString& comment);
-
-private slots:
- void slotLinkActivated(const QString& link);
-
-private:
- QLabel* m_label;
- QString m_comment;
-};
-
-#endif
+++ /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 EDIT_TAGS_DIALOG_H
-#define EDIT_TAGS_DIALOG_H
-
-#include <kdialog.h>
-
-#include <Nepomuk/Tag>
-
-class KLineEdit;
-class QListWidget;
-class QListWidgetItem;
-
-/**
- * @brief Dialog to edit a list of Nepomuk tags.
- *
- * It is possible for the user to add existing tags,
- * create new tags or to remove tags.
- */
-class EditTagsDialog : public KDialog
-{
- Q_OBJECT
-
-public:
- EditTagsDialog(const QList<Nepomuk::Tag>& tags,
- QWidget* parent = 0,
- Qt::WFlags flags = 0);
-
- virtual ~EditTagsDialog();
-
- QList<Nepomuk::Tag> tags() const;
-
-protected slots:
- virtual void slotButtonClicked(int button);
-
-private slots:
- void slotTextEdited(const QString& text);
-
-private:
- void loadTags();
- void removeNewTagItem();
-
-private:
- QList<Nepomuk::Tag> m_tags;
- QListWidget* m_tagsList;
- QListWidgetItem* m_newTagItem;
- KLineEdit* m_newTagEdit;
-};
-
-#endif
#include "dolphin_informationpanelsettings.h"
#include "settings/dolphinsettings.h"
-#include "metadatawidget.h"
-#include "metadataconfigurationdialog.h"
+#include "kmetadatawidget.h"
+#include "kmetadataconfigurationdialog.h"
#include "phononwidget.h"
#include "pixmapviewer.h"
-/**
- * Helper function for sorting items with qSort() in
- * InformationPanelContent::contextMenu().
- */
-bool lessThan(const QAction* action1, const QAction* action2)
-{
- return action1->text() < action2->text();
-}
-
-
InformationPanelContent::InformationPanelContent(QWidget* parent) :
Panel(parent),
m_item(),
m_preview->setVisible(showPreview);
m_previewSeparator->setVisible(showPreview);
- m_metaDataWidget = new MetaDataWidget(parent);
+ m_metaDataWidget = new KMetaDataWidget(parent);
m_metaDataWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
// Encapsulate the MetaDataWidget inside a container that has a dummy widget
m_previewSeparator->setVisible(isChecked);
InformationPanelSettings::setShowPreview(isChecked);
} else if (action == configureAction) {
- MetaDataConfigurationDialog dialog(m_metaDataWidget, this, Qt::Dialog);
+ KMetaDataConfigurationDialog dialog(m_metaDataWidget, this, Qt::Dialog);
dialog.exec();
}
#include <kurl.h>
#include <kvbox.h>
+class KFileItem;
+class KMetaDataWidget;
+class KSeparator;
+class MetaTextLabel;
class PhononWidget;
class PixmapViewer;
-class MetaDataWidget;
-class MetaTextLabel;
class QPixmap;
class QString;
-class KFileItem;
-class KSeparator;
class QLabel;
class QScrollArea;
PixmapViewer* m_preview;
KSeparator* m_previewSeparator;
PhononWidget* m_phononWidget;
- MetaDataWidget* m_metaDataWidget;
+ KMetaDataWidget* m_metaDataWidget;
QScrollArea* m_metaDataArea;
};
-/***************************************************************************
- * Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org> *
- * 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 "commentwidget_p.h"
+/*****************************************************************************
+ * Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org> *
+ * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License version 2 as published by the Free Software Foundation. *
+ * *
+ * This library 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 *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public License *
+ * along with this library; see the file COPYING.LIB. If not, write to *
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301, USA. *
+ *****************************************************************************/
+
+#include "kcommentwidget_p.h"
#include <kdialog.h>
#include <kglobalsettings.h>
#include <QTextEdit>
#include <QVBoxLayout>
-CommentWidget::CommentWidget(QWidget* parent) :
+KCommentWidget::KCommentWidget(QWidget* parent) :
QWidget(parent),
m_label(0),
m_comment()
setText(m_comment);
}
-CommentWidget::~CommentWidget()
+KCommentWidget::~KCommentWidget()
{
}
-void CommentWidget::setText(const QString& comment)
+void KCommentWidget::setText(const QString& comment)
{
if (comment.isEmpty()) {
m_label->setText("<a href=\"addComment\">" + i18nc("@label", "Add Comment...") + "</a>");
m_comment = comment;
}
-QString CommentWidget::text() const
+QString KCommentWidget::text() const
{
return m_comment;
}
-void CommentWidget::slotLinkActivated(const QString& link)
+void KCommentWidget::slotLinkActivated(const QString& link)
{
KDialog dialog(this, Qt::Dialog);
dialog.setButtons(KDialog::Ok | KDialog::Cancel);
dialog.setDefaultButton(KDialog::Ok);
- KConfigGroup dialogConfig(KGlobal::config(), "Nepomuk EditCommentDialog");
+ KConfigGroup dialogConfig(KGlobal::config(), "Nepomuk KEditCommentDialog");
dialog.restoreDialogSize(dialogConfig);
if (dialog.exec() == QDialog::Accepted) {
dialog.saveDialogSize(dialogConfig, KConfigBase::Persistent);
}
-#include "commentwidget_p.moc"
+#include "kcommentwidget_p.moc"
--- /dev/null
+/*****************************************************************************
+ * Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org> *
+ * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License version 2 as published by the Free Software Foundation. *
+ * *
+ * This library 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 *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public License *
+ * along with this library; see the file COPYING.LIB. If not, write to *
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301, USA. *
+ *****************************************************************************/
+
+#ifndef KCOMMENT_WIDGET
+#define KCOMMENT_WIDGET
+
+#include <QString>
+#include <QWidget>
+
+class QLabel;
+
+/**
+ * @brief Allows to edit and show a comment as part of KMetaDataWidget.
+ */
+class KCommentWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ KCommentWidget(QWidget* parent);
+ virtual ~KCommentWidget();
+
+ void setText(const QString& comment);
+ QString text() const;
+
+signals:
+ void commentChanged(const QString& comment);
+
+private slots:
+ void slotLinkActivated(const QString& link);
+
+private:
+ QLabel* m_label;
+ QString m_comment;
+};
+
+#endif
-/***************************************************************************
- * 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 "edittagsdialog_p.h"
+/*****************************************************************************
+ * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License version 2 as published by the Free Software Foundation. *
+ * *
+ * This library 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 *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public License *
+ * along with this library; see the file COPYING.LIB. If not, write to *
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301, USA. *
+ *****************************************************************************/
+
+#include "kedittagsdialog_p.h"
#include <klineedit.h>
#include <klocale.h>
#include <QVBoxLayout>
#include <QWidget>
-EditTagsDialog::EditTagsDialog(const QList<Nepomuk::Tag>& tags,
- QWidget* parent,
- Qt::WFlags flags) :
+KEditTagsDialog::KEditTagsDialog(const QList<Nepomuk::Tag>& tags,
+ QWidget* parent,
+ Qt::WFlags flags) :
KDialog(parent, flags),
m_tags(tags),
m_tagsList(0),
loadTags();
}
-EditTagsDialog::~EditTagsDialog()
+KEditTagsDialog::~KEditTagsDialog()
{
}
-QList<Nepomuk::Tag> EditTagsDialog::tags() const
+QList<Nepomuk::Tag> KEditTagsDialog::tags() const
{
return m_tags;
}
-void EditTagsDialog::slotButtonClicked(int button)
+void KEditTagsDialog::slotButtonClicked(int button)
{
if (button == KDialog::Ok) {
// update m_tags with the checked values, so
- // that the caller of the EditTagsDialog can
- // receive the tags by EditTagsDialog::tags()
+ // that the caller of the KEditTagsDialog can
+ // receive the tags by KEditTagsDialog::tags()
m_tags.clear();
const int count = m_tagsList->count();
}
}
-void EditTagsDialog::slotTextEdited(const QString& text)
+void KEditTagsDialog::slotTextEdited(const QString& text)
{
// Remove unnecessary spaces from a new tag is
// mandatory, as the user cannot see the difference
m_tagsList->scrollToItem(m_newTagItem);
}
-void EditTagsDialog::loadTags()
+void KEditTagsDialog::loadTags()
{
// load all available tags and mark those tags as checked
- // that have been passed to the EditTagsDialog
+ // that have been passed to the KEditTagsDialog
QList<Nepomuk::Tag> tags = Nepomuk::Tag::allTags();
foreach (const Nepomuk::Tag& tag, tags) {
const QString label = tag.label();
}
}
-void EditTagsDialog::removeNewTagItem()
+void KEditTagsDialog::removeNewTagItem()
{
if (m_newTagItem != 0) {
const int row = m_tagsList->row(m_newTagItem);
}
}
-#include "edittagsdialog_p.moc"
+#include "kedittagsdialog_p.moc"
--- /dev/null
+/*****************************************************************************
+ * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License version 2 as published by the Free Software Foundation. *
+ * *
+ * This library 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 *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public License *
+ * along with this library; see the file COPYING.LIB. If not, write to *
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301, USA. *
+ *****************************************************************************/
+
+#ifndef KEDIT_TAGS_DIALOG_H
+#define KEDIT_TAGS_DIALOG_H
+
+#include <kdialog.h>
+#include <nepomuk/tag.h>
+
+class KLineEdit;
+class QListWidget;
+class QListWidgetItem;
+
+/**
+ * @brief Dialog to edit a list of Nepomuk tags.
+ *
+ * It is possible for the user to add existing tags,
+ * create new tags or to remove tags.
+ *
+ * @see KMetaDataConfigurationDialog
+ */
+class KEditTagsDialog : public KDialog
+{
+ Q_OBJECT
+
+public:
+ KEditTagsDialog(const QList<Nepomuk::Tag>& tags,
+ QWidget* parent = 0,
+ Qt::WFlags flags = 0);
+
+ virtual ~KEditTagsDialog();
+
+ QList<Nepomuk::Tag> tags() const;
+
+protected slots:
+ virtual void slotButtonClicked(int button);
+
+private slots:
+ void slotTextEdited(const QString& text);
+
+private:
+ void loadTags();
+ void removeNewTagItem();
+
+private:
+ QList<Nepomuk::Tag> m_tags;
+ QListWidget* m_tagsList;
+ QListWidgetItem* m_newTagItem;
+ KLineEdit* m_newTagEdit;
+};
+
+#endif
-/***************************************************************************
- * 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 "metadataconfigurationdialog.h"
-
-#include "metadatawidget.h"
-
+/*****************************************************************************
+ * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License version 2 as published by the Free Software Foundation. *
+ * *
+ * This library 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 *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public License *
+ * along with this library; see the file COPYING.LIB. If not, write to *
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301, USA. *
+ *****************************************************************************/
+
+#include "kmetadataconfigurationdialog.h"
+#include "kmetadatawidget.h"
#include <klocale.h>
#include <config-nepomuk.h>
#ifdef HAVE_NEPOMUK
#define DISABLE_NEPOMUK_LEGACY
- #include <Nepomuk/Resource>
- #include <Nepomuk/ResourceManager>
- #include <Nepomuk/Types/Property>
- #include <Nepomuk/Variant>
+ #include <nepomuk/resource.h>
+ #include <nepomuk/resourcemanager.h>
+ #include <nepomuk/property.h>
+ #include <nepomuk/variant.h>
#endif
#include <QLabel>
#include <QListWidget>
#include <QVBoxLayout>
-class MetaDataConfigurationDialog::Private
+class KMetaDataConfigurationDialog::Private
{
public:
- Private(MetaDataConfigurationDialog* parent, MetaDataWidget* metaDataWidget);
+ Private(KMetaDataConfigurationDialog* parent, KMetaDataWidget* metaDataWidget);
~Private();
void init();
void loadMetaData();
QString tunedLabel(const QString& label) const;
- int m_hiddenData;
- MetaDataWidget* m_metaDataWidget;
+ int m_visibleDataTypes;
+ KMetaDataWidget* m_metaDataWidget;
QListWidget* m_metaDataList;
private:
- MetaDataConfigurationDialog* const q;
+ KMetaDataConfigurationDialog* const q;
};
-MetaDataConfigurationDialog::Private::Private(MetaDataConfigurationDialog* parent,
- MetaDataWidget* metaDataWidget) :
+KMetaDataConfigurationDialog::Private::Private(KMetaDataConfigurationDialog* parent,
+ KMetaDataWidget* metaDataWidget) :
q(parent)
{
- m_hiddenData = 0;
+ m_visibleDataTypes = 0;
m_metaDataWidget = metaDataWidget;
q->setCaption(i18nc("@title:window", "Configure Shown Data"));
loadMetaData();
- const KConfigGroup dialogConfig(KGlobal::config(), "Nepomuk MetaDataConfigurationDialog");
+ const KConfigGroup dialogConfig(KGlobal::config(), "Nepomuk KMetaDataConfigurationDialog");
q->restoreDialogSize(dialogConfig);
}
-MetaDataConfigurationDialog::Private::~Private()
+KMetaDataConfigurationDialog::Private::~Private()
{
- KConfigGroup dialogConfig(KGlobal::config(), "Nepomuk MetaDataConfigurationDialog");
+ KConfigGroup dialogConfig(KGlobal::config(), "Nepomuk KMetaDataConfigurationDialog");
q->saveDialogSize(dialogConfig, KConfigBase::Persistent);
}
-void MetaDataConfigurationDialog::Private::loadMetaData()
+void KMetaDataConfigurationDialog::Private::loadMetaData()
{
KConfig config("kmetainformationrc", KConfig::NoGlobals);
KConfigGroup settings = config.group("Show");
// Add fixed meta data items where the visibility does not
// depend on the currently used URL.
- int hiddenData = 0;
+ KMetaDataWidget::MetaDataTypes visibleDataTypes = KMetaDataWidget::TypeData |
+ KMetaDataWidget::SizeData |
+ KMetaDataWidget::ModifiedData |
+ KMetaDataWidget::OwnerData |
+ KMetaDataWidget::PermissionsData |
+ KMetaDataWidget::RatingData |
+ KMetaDataWidget::TagsData |
+ KMetaDataWidget::CommentData;
if (m_metaDataWidget != 0) {
- hiddenData = m_metaDataWidget->hiddenData();
+ visibleDataTypes = m_metaDataWidget->visibleDataTypes();
}
typedef QPair<QString, QString> FixedItem;
QList<FixedItem> fixedItems;
- if (!(hiddenData & MetaDataWidget::TypeData)) {
+ if (visibleDataTypes & KMetaDataWidget::TypeData) {
fixedItems.append(FixedItem("type", i18nc("@item::inlistbox", "Type")));
}
- if (!(hiddenData & MetaDataWidget::SizeData)) {
+ if (visibleDataTypes & KMetaDataWidget::SizeData) {
fixedItems.append(FixedItem("size", i18nc("@item::inlistbox", "Size")));
}
- if (!(hiddenData & MetaDataWidget::ModifiedData)) {
+ if (visibleDataTypes & KMetaDataWidget::ModifiedData) {
fixedItems.append(FixedItem("modified", i18nc("@item::inlistbox", "Modified")));
}
- if (!(hiddenData & MetaDataWidget::OwnerData)) {
+ if (visibleDataTypes & KMetaDataWidget::OwnerData) {
fixedItems.append(FixedItem("owner", i18nc("@item::inlistbox", "Owner")));
}
- if (!(hiddenData & MetaDataWidget::PermissionsData)) {
+ if (visibleDataTypes & KMetaDataWidget::PermissionsData) {
fixedItems.append(FixedItem("permissions", i18nc("@item::inlistbox", "Permissions")));
}
#ifdef HAVE_NEPOMUK
if (Nepomuk::ResourceManager::instance()->init() == 0) {
- if (!(hiddenData & MetaDataWidget::RatingData)) {
+ if (visibleDataTypes & KMetaDataWidget::RatingData) {
fixedItems.append(FixedItem("rating", i18nc("@item::inlistbox", "Rating")));
- }
- if (!(hiddenData & MetaDataWidget::TagsData)) {
+ }
+ if (visibleDataTypes & KMetaDataWidget::TagsData) {
fixedItems.append(FixedItem("tags", i18nc("@item::inlistbox", "Tags")));
}
- if (!(hiddenData & MetaDataWidget::CommentData)) {
+ if (visibleDataTypes & KMetaDataWidget::CommentData) {
fixedItems.append(FixedItem("comment", i18nc("@item::inlistbox", "Comment")));
}
}
// should not be shown as second entry.
static const char* hiddenProperties[] = {
"contentSize", // = fixed item "size"
+ "description", // = fixed item "comment"
"fileExtension", // ~ fixed item "type"
"hasTag", // = fixed item "tags"
"name", // not shown as part of the meta data widget
#endif
}
-QString MetaDataConfigurationDialog::Private::tunedLabel(const QString& label) const
+QString KMetaDataConfigurationDialog::Private::tunedLabel(const QString& label) const
{
QString tunedLabel;
const int labelLength = label.length();
return tunedLabel;
}
-MetaDataConfigurationDialog::MetaDataConfigurationDialog(QWidget* parent,
+KMetaDataConfigurationDialog::KMetaDataConfigurationDialog(QWidget* parent,
Qt::WFlags flags) :
KDialog(parent, flags),
d(new Private(this, 0))
{
}
-MetaDataConfigurationDialog::MetaDataConfigurationDialog(MetaDataWidget* metaDataWidget,
+KMetaDataConfigurationDialog::KMetaDataConfigurationDialog(KMetaDataWidget* metaDataWidget,
QWidget* parent,
Qt::WFlags flags) :
KDialog(parent, flags),
{
}
-MetaDataConfigurationDialog::~MetaDataConfigurationDialog()
+KMetaDataConfigurationDialog::~KMetaDataConfigurationDialog()
{
}
-void MetaDataConfigurationDialog::slotButtonClicked(int button)
+void KMetaDataConfigurationDialog::slotButtonClicked(int button)
{
if (button == KDialog::Ok) {
KConfig config("kmetainformationrc", KConfig::NoGlobals);
if (d->m_metaDataWidget != 0) {
// trigger an update
- d->m_metaDataWidget->setHiddenData(d->m_metaDataWidget->hiddenData());
+ d->m_metaDataWidget->setVisibleDataTypes(d->m_metaDataWidget->visibleDataTypes());
}
accept();
} else {
}
}
-#include "metadataconfigurationdialog.moc"
+#include "kmetadataconfigurationdialog.moc"
--- /dev/null
+/*****************************************************************************
+ * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License version 2 as published by the Free Software Foundation. *
+ * *
+ * This library 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 *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public License *
+ * along with this library; see the file COPYING.LIB. If not, write to *
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301, USA. *
+ *****************************************************************************/
+
+#ifndef KMETA_DATA_CONFIGURATION_DIALOG_H
+#define KMETA_DATA_CONFIGURATION_DIALOG_H
+
+#include <kdialog.h>
+#include <kfile_export.h>
+
+class KMetaDataWidget;
+
+/**
+ * @brief Dialog which allows to configure which meta data should be shown.
+ * @see KMetaDataWidget
+ */
+class KFILE_EXPORT KMetaDataConfigurationDialog : public KDialog
+{
+ Q_OBJECT
+
+public:
+ /**
+ * Allows to configure the visibility of all available meta
+ * data.
+ */
+ KMetaDataConfigurationDialog(QWidget* parent = 0,
+ Qt::WFlags flags = 0);
+
+ /**
+ * Allows to configure the visibility of the meta data
+ * shown by the meta data widget. The number of offered
+ * meta data is optimized for the set of file items
+ * that are applied to the meta data widget.
+ */
+ KMetaDataConfigurationDialog(KMetaDataWidget* metaDataWidget,
+ QWidget* parent = 0,
+ Qt::WFlags flags = 0);
+
+ virtual ~KMetaDataConfigurationDialog();
+
+protected slots:
+ virtual void slotButtonClicked(int button);
+
+private:
+ class Private;
+ Private* d;
+};
+
+#endif
-/***************************************************************************
- * Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org> *
- * 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 "metadatawidget.h"
+/*****************************************************************************
+ * Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org> *
+ * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License version 2 as published by the Free Software Foundation. *
+ * *
+ * This library 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 *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public License *
+ * along with this library; see the file COPYING.LIB. If not, write to *
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301, USA. *
+ *****************************************************************************/
+
+#include "kmetadatawidget.h"
#include <kconfig.h>
#include <kconfiggroup.h>
#ifdef HAVE_NEPOMUK
#define DISABLE_NEPOMUK_LEGACY
- #include "commentwidget_p.h"
- #include "nepomukmassupdatejob_p.h"
- #include "taggingwidget_p.h"
+ #include "kcommentwidget_p.h"
+ #include "ktaggingwidget_p.h"
- #include <Nepomuk/KRatingWidget>
- #include <Nepomuk/Resource>
- #include <Nepomuk/ResourceManager>
- #include <Nepomuk/Types/Property>
- #include <Nepomuk/Variant>
+ #include <nepomuk/kratingwidget.h>
+ #include <nepomuk/resource.h>
+ #include <nepomuk/resourcemanager.h>
+ #include <nepomuk/property.h>
+ #include <nepomuk/variant.h>
+ #include "nepomukmassupdatejob_p.h"
#include <QMutex>
#include <QSpacerItem>
#include <QThread>
#endif
-#include <kdebug.h>
-
-class MetaDataWidget::Private
+class KMetaDataWidget::Private
{
public:
struct Row
QWidget* infoWidget;
};
- Private(MetaDataWidget* parent);
+ Private(KMetaDataWidget* parent);
~Private();
void addRow(QLabel* label, QWidget* infoWidget);
void startChangeDataJob(KJob* job);
bool m_isSizeVisible;
- MetaDataTypes m_hiddenData;
+ MetaDataTypes m_visibleDataTypes;
QList<KFileItem> m_fileItems;
QList<Row> m_rows;
#ifdef HAVE_NEPOMUK
KRatingWidget* m_ratingWidget;
- TaggingWidget* m_taggingWidget;
- CommentWidget* m_commentWidget;
+ KTaggingWidget* m_taggingWidget;
+ KCommentWidget* m_commentWidget;
// shared data between the GUI-thread and
// the loader-thread (see LoadFilesThread):
#endif
private:
- MetaDataWidget* const q;
+ KMetaDataWidget* const q;
};
-MetaDataWidget::Private::Private(MetaDataWidget* parent) :
+KMetaDataWidget::Private::Private(KMetaDataWidget* parent) :
m_isSizeVisible(true),
- m_hiddenData(None),
+ m_visibleDataTypes(TypeData | SizeData | ModifiedData | OwnerData |
+ PermissionsData | RatingData | TagsData | CommentData),
m_fileItems(),
m_rows(),
m_gridLayout(0),
connect(m_ratingWidget, SIGNAL(ratingChanged(unsigned int)),
q, SLOT(slotRatingChanged(unsigned int)));
- m_taggingWidget = new TaggingWidget(parent);
+ m_taggingWidget = new KTaggingWidget(parent);
connect(m_taggingWidget, SIGNAL(tagsChanged(const QList<Nepomuk::Tag>&)),
q, SLOT(slotTagsChanged(const QList<Nepomuk::Tag>&)));
- m_commentWidget = new CommentWidget(parent);
+ m_commentWidget = new KCommentWidget(parent);
connect(m_commentWidget, SIGNAL(commentChanged(const QString&)),
q, SLOT(slotCommentChanged(const QString&)));
updateRowsVisibility();
}
-MetaDataWidget::Private::~Private()
+KMetaDataWidget::Private::~Private()
{
#ifdef HAVE_NEPOMUK
delete m_loadFilesThread;
#endif
}
-void MetaDataWidget::Private::addRow(QLabel* label, QWidget* infoWidget)
+void KMetaDataWidget::Private::addRow(QLabel* label, QWidget* infoWidget)
{
Row row;
row.label = label;
m_gridLayout->addWidget(infoWidget, rowIndex, 2, Qt::AlignLeft);
}
-void MetaDataWidget::Private::setRowVisible(QWidget* infoWidget, bool visible)
+void KMetaDataWidget::Private::setRowVisible(QWidget* infoWidget, bool visible)
{
foreach (const Row& row, m_rows) {
if (row.infoWidget == infoWidget) {
}
-void MetaDataWidget::Private::initMetaInfoSettings()
+void KMetaDataWidget::Private::initMetaInfoSettings()
{
KConfig config("kmetainformationrc", KConfig::NoGlobals);
KConfigGroup settings = config.group("Show");
}
}
-void MetaDataWidget::Private::updateRowsVisibility()
+void KMetaDataWidget::Private::updateRowsVisibility()
{
KConfig config("kmetainformationrc", KConfig::NoGlobals);
KConfigGroup settings = config.group("Show");
setRowVisible(m_typeInfo,
- !(m_hiddenData & MetaDataWidget::TypeData) &&
+ (m_visibleDataTypes & KMetaDataWidget::TypeData) &&
settings.readEntry("type", true));
// Cache in m_isSizeVisible whether the size should be shown. This
// is necessary as the size is temporary hidden when the target
// file item is a directory.
- m_isSizeVisible = !(m_hiddenData & MetaDataWidget::SizeData) &&
+ m_isSizeVisible = (m_visibleDataTypes & KMetaDataWidget::SizeData) &&
settings.readEntry("size", true);
setRowVisible(m_sizeInfo, m_isSizeVisible);
setRowVisible(m_modifiedInfo,
- !(m_hiddenData & MetaDataWidget::ModifiedData) &&
+ (m_visibleDataTypes & KMetaDataWidget::ModifiedData) &&
settings.readEntry("modified", true));
setRowVisible(m_ownerInfo,
- !(m_hiddenData & MetaDataWidget::OwnerData) &&
+ (m_visibleDataTypes & KMetaDataWidget::OwnerData) &&
settings.readEntry("owner", true));
setRowVisible(m_permissionsInfo,
- !(m_hiddenData & MetaDataWidget::PermissionsData) &&
+ (m_visibleDataTypes & KMetaDataWidget::PermissionsData) &&
settings.readEntry("permissions", true));
#ifdef HAVE_NEPOMUK
if (Nepomuk::ResourceManager::instance()->init() == 0) {
setRowVisible(m_ratingWidget,
- !(m_hiddenData & MetaDataWidget::RatingData) &&
+ (m_visibleDataTypes & KMetaDataWidget::RatingData) &&
settings.readEntry("rating", true));
setRowVisible(m_taggingWidget,
- !(m_hiddenData & MetaDataWidget::TagsData) &&
+ (m_visibleDataTypes & KMetaDataWidget::TagsData) &&
settings.readEntry("tags", true));
setRowVisible(m_commentWidget,
- !(m_hiddenData & MetaDataWidget::CommentData) &&
+ (m_visibleDataTypes & KMetaDataWidget::CommentData) &&
settings.readEntry("comment", true));
}
#endif
}
-void MetaDataWidget::Private::slotLoadingFinished()
+void KMetaDataWidget::Private::slotLoadingFinished()
{
#ifdef HAVE_NEPOMUK
QMutexLocker locker(&m_mutex);
delete m_rows[i].infoWidget;
m_rows.pop_back();
}
-
- emit q->loadingFinished();
#endif
}
-void MetaDataWidget::Private::slotRatingChanged(unsigned int rating)
+void KMetaDataWidget::Private::slotRatingChanged(unsigned int rating)
{
#ifdef HAVE_NEPOMUK
QMutexLocker locker(&m_mutex);
locker.unlock();
startChangeDataJob(job);
#endif
- emit q->ratingChanged(rating);
}
-void MetaDataWidget::Private::slotTagsChanged(const QList<Nepomuk::Tag>& tags)
+void KMetaDataWidget::Private::slotTagsChanged(const QList<Nepomuk::Tag>& tags)
{
#ifdef HAVE_NEPOMUK
m_taggingWidget->setTags(tags);
locker.unlock();
startChangeDataJob(job);
#endif
- emit q->tagsChanged(tags);
}
-void MetaDataWidget::Private::slotCommentChanged(const QString& comment)
+void KMetaDataWidget::Private::slotCommentChanged(const QString& comment)
{
#ifdef HAVE_NEPOMUK
QMutexLocker locker(&m_mutex);
locker.unlock();
startChangeDataJob(job);
#endif
- emit q->commentChanged(comment);
}
-void MetaDataWidget::Private::slotMetaDataUpdateDone()
+void KMetaDataWidget::Private::slotMetaDataUpdateDone()
{
q->setEnabled(true);
}
-void MetaDataWidget::Private::startChangeDataJob(KJob* job)
+void KMetaDataWidget::Private::startChangeDataJob(KJob* job)
{
connect(job, SIGNAL(result(KJob*)),
q, SLOT(slotMetaDataUpdateDone()));
}
#ifdef HAVE_NEPOMUK
-MetaDataWidget::Private::LoadFilesThread::LoadFilesThread(
- MetaDataWidget::Private::SharedData* m_sharedData,
+KMetaDataWidget::Private::LoadFilesThread::LoadFilesThread(
+ KMetaDataWidget::Private::SharedData* m_sharedData,
QMutex* m_mutex) :
m_sharedData(m_sharedData),
m_mutex(m_mutex),
{
}
-MetaDataWidget::Private::LoadFilesThread::~LoadFilesThread()
+KMetaDataWidget::Private::LoadFilesThread::~LoadFilesThread()
{
// This thread may very well be deleted during execution. We need
// to protect it from crashes here.
wait();
}
-void MetaDataWidget::Private::LoadFilesThread::loadFiles(const KUrl::List& urls)
+void KMetaDataWidget::Private::LoadFilesThread::loadFiles(const KUrl::List& urls)
{
QMutexLocker locker(m_mutex);
m_urls = urls;
start();
}
-void MetaDataWidget::Private::LoadFilesThread::run()
+void KMetaDataWidget::Private::LoadFilesThread::run()
{
QMutexLocker locker(m_mutex);
const KUrl::List urls = m_urls;
m_sharedData->files = files;
}
-QString MetaDataWidget::Private::LoadFilesThread::tunedLabel(const QString& label) const
+QString KMetaDataWidget::Private::LoadFilesThread::tunedLabel(const QString& label) const
{
QString tunedLabel;
const int labelLength = label.length();
#endif // HAVE_NEPOMUK
-MetaDataWidget::MetaDataWidget(QWidget* parent) :
+KMetaDataWidget::KMetaDataWidget(QWidget* parent) :
QWidget(parent),
d(new Private(this))
{
}
-MetaDataWidget::~MetaDataWidget()
+KMetaDataWidget::~KMetaDataWidget()
{
delete d;
}
-void MetaDataWidget::setItem(const KFileItem& item)
+void KMetaDataWidget::setItem(const KFileItem& item)
{
// update values for "type", "size", "modified",
// "owner" and "permissions" synchronously
setItems(KFileItemList() << item);
}
-void MetaDataWidget::setItems(const KFileItemList& items)
+void KMetaDataWidget::setItems(const KFileItemList& items)
{
d->m_fileItems = items;
#endif
}
-void MetaDataWidget::setItem(const KUrl& url)
+void KMetaDataWidget::setItem(const KUrl& url)
{
KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
item.refresh();
setItem(item);
}
-void MetaDataWidget::setItems(const QList<KUrl>& urls)
+void KMetaDataWidget::setItems(const QList<KUrl>& urls)
{
KFileItemList items;
foreach (const KUrl& url, urls) {
setItems(items);
}
-KFileItemList MetaDataWidget::items() const
+KFileItemList KMetaDataWidget::items() const
{
return d->m_fileItems;
}
-void MetaDataWidget::setHiddenData(MetaDataTypes data)
+void KMetaDataWidget::setVisibleDataTypes(MetaDataTypes data)
{
- d->m_hiddenData = data;
+ d->m_visibleDataTypes = data;
d->updateRowsVisibility();
}
-MetaDataWidget::MetaDataTypes MetaDataWidget::hiddenData() const
-{
- return d->m_hiddenData;
-}
-
-unsigned int MetaDataWidget::rating() const
+KMetaDataWidget::MetaDataTypes KMetaDataWidget::visibleDataTypes() const
{
-#ifdef HAVE_NEPOMUK
- QMutexLocker locker(&d->m_mutex);
- return d->m_sharedData.rating;
-#else
- return 0;
-#endif
-}
-
-QList<Nepomuk::Tag> MetaDataWidget::tags() const
-{
-#ifdef HAVE_NEPOMUK
- QMutexLocker locker(&d->m_mutex);
- return d->m_sharedData.tags;
-#else
- return QList<Nepomuk::Tag>();
-#endif
-}
-
-QString MetaDataWidget::comment() const
-{
-#ifdef HAVE_NEPOMUK
- QMutexLocker locker(&d->m_mutex);
- return d->m_sharedData.comment;
-#else
- return QString();
-#endif
+ return d->m_visibleDataTypes;
}
-#include "metadatawidget.moc"
+#include "kmetadatawidget.moc"
--- /dev/null
+/*****************************************************************************
+ * Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org> *
+ * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License version 2 as published by the Free Software Foundation. *
+ * *
+ * This library 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 *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public License *
+ * along with this library; see the file COPYING.LIB. If not, write to *
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301, USA. *
+ *****************************************************************************/
+
+#ifndef KMETADATAWIDGET_H
+#define KMETADATAWIDGET_H
+
+#include <kfile_export.h>
+#include <kfileitem.h>
+
+#include <QList>
+#include <QWidget>
+
+class KUrl;
+
+/**
+ * @brief Shows the meta data of one or more file items.
+ *
+ * Meta data like name, size, rating, comment, ... are
+ * shown as several rows containing a description and
+ * the meta data value. It is possible for the user
+ * to change specific meta data like rating, tags and
+ * comment. The changes are stored automatically by the
+ * meta data widget.
+ */
+class KFILE_EXPORT KMetaDataWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ /**
+ * Allows to specify which general data types should be shown
+ * by the meta data widget.
+ * @see KMetaDataWidget::setVisibleDataTypes()
+ * @see KMetaDataWidget::visibleDataTypes()
+ */
+ enum MetaDataType
+ {
+ None = 0,
+ TypeData = 1,
+ SizeData = 2,
+ ModifiedData = 4,
+ OwnerData = 8,
+ PermissionsData = 16,
+ RatingData = 32,
+ TagsData = 64,
+ CommentData = 128
+ };
+ Q_DECLARE_FLAGS(MetaDataTypes, MetaDataType)
+
+ explicit KMetaDataWidget(QWidget* parent = 0);
+ virtual ~KMetaDataWidget();
+
+ /**
+ * Triggers the asynchronous loading of the meta data
+ * for the file item \p item. Connect to the signal
+ * loadingFinished() to be able to read the meta
+ * data.
+ */
+ void setItem(const KFileItem& item);
+
+ /**
+ * Triggers the asynchronous loading of the meta data
+ * for the file items \p items. Connect to the signal
+ * loadingFinished() to be able to read the meta
+ * data.
+ */
+ void setItems(const KFileItemList& items);
+
+ /**
+ * Convenience method for KMetaDataWidget::setItem(const KFileItem&),
+ * if the application has only an URL and no file item.
+ * For performance reason it is recommended to use this convenience
+ * method only if the application does not have a file item already.
+ */
+ void setItem(const KUrl& url);
+
+ /**
+ * Convenience method for KMetaDataWidget::setItems(const KFileItemList&),
+ * if the application has only URLs and no file items.
+ * For performance reason it is recommended to use this convenience
+ * method only if the application does not have a file items already.
+ */
+ void setItems(const QList<KUrl>& urls);
+
+ KFileItemList items() const;
+
+ /**
+ * Specifies which kind of data types should be shown (@see KMetaDataWidget::Data).
+ * Example: metaDataWidget->setVisibleDataTypes(KMetaDataWidget::TypeData | KMetaDataWidget::ModifiedData);
+ * Per default all data types are shown.
+ */
+ void setVisibleDataTypes(MetaDataTypes data);
+
+ /**
+ * Returns which kind of data is shown (@see KMetaDataWidget::Data).
+ * Example: if (metaDataWidget->shownData() & KMetaDataWidget::TypeData) ...
+ */
+ MetaDataTypes visibleDataTypes() const;
+
+private:
+ class Private;
+ Private* d;
+
+ Q_PRIVATE_SLOT(d, void slotLoadingFinished())
+ Q_PRIVATE_SLOT(d, void slotRatingChanged(unsigned int rating))
+ Q_PRIVATE_SLOT(d, void slotTagsChanged(const QList<Nepomuk::Tag>& tags))
+ Q_PRIVATE_SLOT(d, void slotCommentChanged(const QString& comment))
+ Q_PRIVATE_SLOT(d, void slotMetaDataUpdateDone())
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(KMetaDataWidget::MetaDataTypes)
+
+#endif
-/***************************************************************************
- * 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 "taggingwidget_p.h"
-
-#include "edittagsdialog_p.h"
+/*****************************************************************************
+ * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License version 2 as published by the Free Software Foundation. *
+ * *
+ * This library 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 *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public License *
+ * along with this library; see the file COPYING.LIB. If not, write to *
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301, USA. *
+ *****************************************************************************/
+
+#include "ktaggingwidget_p.h"
+
+#include "kedittagsdialog_p.h"
#include <kglobalsettings.h>
#include <klocale.h>
#include <QLabel>
#include <QVBoxLayout>
-TaggingWidget::TaggingWidget(QWidget* parent) :
+KTaggingWidget::KTaggingWidget(QWidget* parent) :
QWidget(parent),
m_label(0),
m_tags(),
setTags(QList<Nepomuk::Tag>());
}
-TaggingWidget::~TaggingWidget()
+KTaggingWidget::~KTaggingWidget()
{
}
-void TaggingWidget::setTags(const QList<Nepomuk::Tag>& tags)
+void KTaggingWidget::setTags(const QList<Nepomuk::Tag>& tags)
{
m_tags = tags;
}
}
-QList<Nepomuk::Tag> TaggingWidget::tags() const
+QList<Nepomuk::Tag> KTaggingWidget::tags() const
{
return m_tags;
}
-void TaggingWidget::slotLinkActivated(const QString& link)
+void KTaggingWidget::slotLinkActivated(const QString& link)
{
Q_UNUSED(link);
- EditTagsDialog dialog(m_tags, this, Qt::Dialog);
- KConfigGroup dialogConfig(KGlobal::config(), "Nepomuk EditTagsDialog");
+ KEditTagsDialog dialog(m_tags, this, Qt::Dialog);
+ KConfigGroup dialogConfig(KGlobal::config(), "Nepomuk KEditTagsDialog");
dialog.restoreDialogSize(dialogConfig);
if (dialog.exec() == QDialog::Accepted) {
dialog.saveDialogSize(dialogConfig, KConfigBase::Persistent);
}
-#include "taggingwidget_p.moc"
+#include "ktaggingwidget_p.moc"
--- /dev/null
+/*****************************************************************************
+ * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License version 2 as published by the Free Software Foundation. *
+ * *
+ * This library 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 *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public License *
+ * along with this library; see the file COPYING.LIB. If not, write to *
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301, USA. *
+ *****************************************************************************/
+
+#ifndef TAGGING_WIDGET_H
+#define TAGGING_WIDGET_H
+
+#include <nepomuk/tag.h>
+#include <QString>
+#include <QWidget>
+
+class QLabel;
+
+/**
+ * @brief Allows to edit and show tags as part of KMetaDataWidget.
+ */
+class KTaggingWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ KTaggingWidget(QWidget* parent);
+ virtual ~KTaggingWidget();
+
+ void setTags(const QList<Nepomuk::Tag>& tags);
+ QList<Nepomuk::Tag> tags() const;
+
+signals:
+ void tagsChanged(const QList<Nepomuk::Tag>& tags);
+
+private slots:
+ void slotLinkActivated(const QString& link);
+
+private:
+ QLabel* m_label;
+ QList<Nepomuk::Tag> m_tags;
+ QString m_tagsText;
+};
+
+#endif
+++ /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 META_DATA_CONFIGURATION_DIALOG_H
-#define META_DATA_CONFIGURATION_DIALOG_H
-
-#include <kdialog.h>
-
-class MetaDataWidget;
-
-/**
- * @brief Dialog which allows to configure which meta data should be shown.
- */
-class MetaDataConfigurationDialog : public KDialog
-{
- Q_OBJECT
-
-public:
- /**
- * Allows to configure the visibility of all available meta
- * data.
- */
- MetaDataConfigurationDialog(QWidget* parent = 0,
- Qt::WFlags flags = 0);
-
- /**
- * Allows to configure the visibility of the meta data
- * shown by the meta data widget. The number of offered
- * meta data is optimized for the set of file items
- * that are applied to the meta data widget.
- */
- MetaDataConfigurationDialog(MetaDataWidget* metaDataWidget,
- QWidget* parent = 0,
- Qt::WFlags flags = 0);
-
- virtual ~MetaDataConfigurationDialog();
-
-protected slots:
- virtual void slotButtonClicked(int button);
-
-private:
- class Private;
- Private* d;
-};
-
-#endif
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org> *
- * 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 METADATAWIDGET_H
-#define METADATAWIDGET_H
-
-#include <config-nepomuk.h>
-#ifdef HAVE_NEPOMUK
- #include <Nepomuk/Tag>
-#else
- // The HAVE_NEPOMUK macro cannot be used in combination with
- // Q_PRIVATE_SLOT, hence a workaround is used for environments
- // where Nepomuk is not available:
- namespace Nepomuk {
- typedef int Tag;
- }
-#endif
-
-#include <kfileitem.h>
-
-#include <QList>
-#include <QWidget>
-
-class KUrl;
-
-/**
- * @brief Shows the meta data of one or more file items.
- *
- * Meta data like name, size, rating, comment, ... are
- * shown as several rows containing a description and
- * the meta data value. It is possible for the user
- * to change specific meta data like rating, tags and
- * comment. The changes are stored automatically by the
- * meta data widget.
- */
-class MetaDataWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- /**
- * Allows to specify which general data should be hidden
- * by the meta data widget.
- * @see MetaDataWidget::setHiddenData()
- * @see MetaDataWidget::hiddenData()
- */
- enum MetaDataType
- {
- None = 0,
- TypeData = 1,
- SizeData= 2,
- ModifiedData = 4,
- OwnerData = 8,
- PermissionsData = 16,
- RatingData = 32,
- TagsData = 64,
- CommentData = 128
- };
- Q_DECLARE_FLAGS( MetaDataTypes, MetaDataType )
-
- explicit MetaDataWidget(QWidget* parent = 0);
- virtual ~MetaDataWidget();
-
- /**
- * Triggers the asynchronous loading of the meta data
- * for the file item \p item. Connect to the signal
- * loadingFinished() to be able to read the meta
- * data.
- */
- void setItem(const KFileItem& item);
-
- /**
- * Triggers the asynchronous loading of the meta data
- * for the file items \p items. Connect to the signal
- * loadingFinished() to be able to read the meta
- * data.
- */
- void setItems(const KFileItemList& items);
-
- /**
- * Convenience method for MetaDataWidget::setItem(const KFileItem&),
- * if the application has only an URL and no file item.
- * For performance reason it is recommended to use this convenience
- * method only if the application does not have a file item already.
- */
- void setItem(const KUrl& url);
-
- /**
- * Convenience method for MetaDataWidget::setItems(const KFileItemList&),
- * if the application has only URLs and no file items.
- * For performance reason it is recommended to use this convenience
- * method only if the application does not have a file items already.
- */
- void setItems(const QList<KUrl>& urls);
-
- KFileItemList items() const;
-
- /**
- * Specifies which kind of data should be hidden (@see MetaDataWidget::Data).
- * Example: metaDataWidget->setHiddenData(MetaDataWidget::TypeData | ModifiedData);
- * Per default no data is hidden.
- */
- void setHiddenData(MetaDataTypes data);
-
- /**
- * Returns which kind of data is hidden (@see MetaDataWidget::Data).
- * Example: if (metaDataWidget->hiddenData() & MetaDataWidget::TypeData) ...
- */
- MetaDataTypes hiddenData() const;
-
- /**
- * Returns the rating for the currently set item(s). It is required
- * to wait for the signal loadingFinished() or ratingChanged()
- * to get a valid result.
- */
- unsigned int rating() const;
-
- /**
- * Returns the tags for the currently set item(s). It is required
- * to wait for the signal loadingFinished() or tagsChanged()
- * to get a valid result.
- */
- QList<Nepomuk::Tag> tags() const;
-
- /**
- * Returns the comment for the currently set item(s). It is required
- * to wait for the signal loadingFinished() or commentChanged()
- * to get a valid result.
- */
- QString comment() const;
-
-signals:
- /**
- * Is emitted if the loading of the meta data has been finished
- * after invoking MetaDataWidget::setItem() or MetaDataWidget::setItems().
- */
- void loadingFinished();
-
- /**
- * Is emitted after the user has changed the rating.
- * The changed rating is automatically stored already by
- * the meta data widget.
- * Note that the signal is not emitted if the rating has
- * indirectly been changed by MetaDataWidget::setItem() or
- * MetaDataWidget::setItems(). In this case connect to
- * the signal loadingFinished() instead.
- */
- void ratingChanged(const int rating);
-
- /**
- * Is emitted after the user has changed the tags.
- * The changed tags are automatically stored already by
- * the meta data widget.
- * Note that the signal is not emitted if the tags have
- * indirectly been changed by MetaDataWidget::setItem() or
- * MetaDataWidget::setItems(). In this case connect to
- * the signal loadingFinished() instead.
- */
- void tagsChanged(const QList<Nepomuk::Tag>& tags);
-
- /**
- * Is emitted after the user has changed the comment.
- * The changed comment is automatically stored already by
- * the meta data widget.
- * Note that the signal is not emitted if the comment has
- * indirectly been changed by MetaDataWidget::setItem() or
- * MetaDataWidget::setItems(). In this case connect to
- * the signal loadingFinished() instead.
- */
- void commentChanged(const QString& comment);
-
-private:
- class Private;
- Private* d;
-
- Q_PRIVATE_SLOT(d, void slotLoadingFinished())
- Q_PRIVATE_SLOT(d, void slotRatingChanged(unsigned int rating))
- Q_PRIVATE_SLOT(d, void slotTagsChanged(const QList<Nepomuk::Tag>& tags))
- Q_PRIVATE_SLOT(d, void slotCommentChanged(const QString& comment))
- Q_PRIVATE_SLOT(d, void slotMetaDataUpdateDone())
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(MetaDataWidget::MetaDataTypes)
-
-#endif
+++ /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 TAGGING_WIDGET_H
-#define TAGGING_WIDGET_H
-
-#include <nepomuk/tag.h>
-#include <QString>
-#include <QWidget>
-
-class QLabel;
-
-class TaggingWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- TaggingWidget(QWidget* parent);
- virtual ~TaggingWidget();
-
- void setTags(const QList<Nepomuk::Tag>& tags);
- QList<Nepomuk::Tag> tags() const;
-
-signals:
- void tagsChanged(const QList<Nepomuk::Tag>& tags);
-
-private slots:
- void slotLinkActivated(const QString& link);
-
-private:
- QLabel* m_label;
- QList<Nepomuk::Tag> m_tags;
- QString m_tagsText;
-};
-
-#endif