[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [conquirere] src: added documents sidebar widget (kmetadatawidget.h)
From: Jörg_Ehrichs <Joerg.Ehrichs () gmx ! de>
Date: 2011-09-22 21:36:15
Message-ID: 20110922213615.862B3A607A () git ! kde ! org
[Download RAW message or body]
Git commit ff9b93518eba7f127ab988d3d0575f099a1c5306 by Jörg Ehrichs.
Committed on 22/09/2011 at 23:36.
Pushed by jehrichs into branch 'master'.
added documents sidebar widget (kmetadatawidget.h)
M +2 -0 src/CMakeLists.txt
A +92 -0 src/sidebar/documentwidget.cpp [License: GPL (v2+)]
C +17 -25 src/sidebar/documentwidget.h [from: src/sidebar/referencewidget.h - 055% similarity]
A +155 -0 src/sidebar/documentwidget.ui
M +0 -3 src/sidebar/referencewidget.h
M +2 -1 src/sidebar/sidebarwidget.cpp
http://commits.kde.org/conquirere/ff9b93518eba7f127ab988d3d0575f099a1c5306
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1ae5a62..abf17de 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -29,6 +29,7 @@ set(conquirere_SRCS
sidebar/publicationwidget.cpp
sidebar/referencewidget.cpp
sidebar/listpublicationsdialog.cpp
+ sidebar/documentwidget.cpp
)
kde4_add_ui_files( conquirere_SRCS
@@ -40,6 +41,7 @@ kde4_add_ui_files( conquirere_SRCS
sidebar/referencewidget.ui
sidebar/listpublicationsdialog.ui
sidebar/publicationwidget.ui
+ sidebar/documentwidget.ui
)
diff --git a/src/sidebar/documentwidget.cpp b/src/sidebar/documentwidget.cpp
new file mode 100644
index 0000000..073247e
--- /dev/null
+++ b/src/sidebar/documentwidget.cpp
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2011 Jörg Ehrichs <joerg.ehichs@gmx.de>
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "documentwidget.h"
+#include "ui_documentwidget.h"
+
+#include <KGlobalSettings>
+#include <KMimeType>
+#include <KIconLoader>
+#include <kfilemetadatawidget.h>
+#include <Nepomuk/Vocabulary/NIE>
+#include <Nepomuk/Vocabulary/NFO>
+#include <Nepomuk/Variant>
+
+#include <QString>
+#include <QVBoxLayout>
+#include <QDebug>
+
+DocumentWidget::DocumentWidget(QWidget *parent) :
+ SidebarComponent(parent),
+ ui(new Ui::DocumentWidget)
+{
+ ui->setupUi(this);
+
+ setFont(KGlobalSettings::smallestReadableFont());
+ m_kfmd = new KFileMetaDataWidget();
+
+ QVBoxLayout *vbl = qobject_cast<QVBoxLayout *>(ui->contents->layout());
+ vbl->insertWidget(0, m_kfmd);
+ m_kfmd->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
+ m_kfmd->show();
+
+}
+
+DocumentWidget::~DocumentWidget()
+{
+ delete ui;
+}
+
+void DocumentWidget::setResource(Nepomuk::Resource & resource)
+{
+ m_document = resource;
+
+ if(m_document.isValid()) {
+ //fetch the documents icon
+ QString fileUrl = m_document.property(Nepomuk::Vocabulary::NIE::url()).toString();
+
+ QString mimeType = KMimeType::iconNameForUrl( fileUrl);
+
+ KIconLoader kil;
+ QPixmap fileIcon = kil.loadMimeTypeIcon(mimeType, KIconLoader::Desktop);
+
+ ui->icon->setPixmap(fileIcon);
+
+ // show file meta data
+ KFileItem kf(KFileItem::Unknown, KFileItem::Unknown, KUrl(fileUrl));
+ kf.refresh();
+ kf.refreshMimeType();
+ KFileItemList kfil;
+ kfil.append(kf);
+ m_kfmd->setItems(kfil);
+ }
+}
+
+void DocumentWidget::clear()
+{
+}
+
+void DocumentWidget::createPublication()
+{
+
+}
+
+void DocumentWidget::removePublication()
+{
+
+}
+
diff --git a/src/sidebar/referencewidget.h b/src/sidebar/documentwidget.h
similarity index 55%
copy from src/sidebar/referencewidget.h
copy to src/sidebar/documentwidget.h
index fc46889..503258c 100644
--- a/src/sidebar/referencewidget.h
+++ b/src/sidebar/documentwidget.h
@@ -15,49 +15,41 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef REFERENCEWIDGET_H
-#define REFERENCEWIDGET_H
+#ifndef DOCUMENTWIDGET_H
+#define DOCUMENTWIDGET_H
#include "sidebarcomponent.h"
#include <Nepomuk/Resource>
+#include <QWidget>
+
namespace Ui {
- class ReferenceWidget;
+ class DocumentWidget;
}
-class QWidget;
-class ReferenceWidget : public SidebarComponent
+class KFileMetaDataWidget;
+
+class DocumentWidget : public SidebarComponent
{
Q_OBJECT
-public:
- explicit ReferenceWidget(QWidget *parent = 0);
- void setDialogMode(bool dialogMode);
+public:
+ explicit DocumentWidget(QWidget *parent = 0);
+ ~DocumentWidget();
public slots:
virtual void setResource(Nepomuk::Resource & resource);
virtual void clear();
- void showCreateReference(bool showIt);
-
-signals:
- /* notify connected editwidgets to update their info */
- void resourceChanged(Nepomuk::Resource & resource);
private slots:
- void showPublicationList();
-
- //enables/disbales the chapter widget if the publication is valida valid book or not
- void showChapter();
- void createReference();
- void removeReference();
+ void createPublication();
+ void removePublication();
private:
- Nepomuk::Resource m_reference;
-
- Ui::ReferenceWidget *ui;
+ Nepomuk::Resource m_document;
- QWidget *m_newReferenceWidget;
- QWidget *m_referenceWidget;
+ Ui::DocumentWidget *ui;
+ KFileMetaDataWidget *m_kfmd;
};
-#endif // REFERENCEWIDGET_H
+#endif // DOCUMENTWIDGET_H
diff --git a/src/sidebar/documentwidget.ui b/src/sidebar/documentwidget.ui
new file mode 100644
index 0000000..719e857
--- /dev/null
+++ b/src/sidebar/documentwidget.ui
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DocumentWidget</class>
+ <widget class="QWidget" name="DocumentWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>267</width>
+ <height>441</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Documents</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="icon">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>64</width>
+ <height>64</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>64</width>
+ <height>64</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="contents">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>253</width>
+ <height>297</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>286</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="createPublication">
+ <property name="text">
+ <string>Add Publication</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/sidebar/referencewidget.h b/src/sidebar/referencewidget.h
index fc46889..d5f54b1 100644
--- a/src/sidebar/referencewidget.h
+++ b/src/sidebar/referencewidget.h
@@ -55,9 +55,6 @@ private:
Nepomuk::Resource m_reference;
Ui::ReferenceWidget *ui;
-
- QWidget *m_newReferenceWidget;
- QWidget *m_referenceWidget;
};
#endif // REFERENCEWIDGET_H
diff --git a/src/sidebar/sidebarwidget.cpp b/src/sidebar/sidebarwidget.cpp
index a78d51e..60ad569 100644
--- a/src/sidebar/sidebarwidget.cpp
+++ b/src/sidebar/sidebarwidget.cpp
@@ -20,6 +20,7 @@
#include "publicationwidget.h"
#include "sidebarcomponent.h"
#include "referencewidget.h"
+#include "documentwidget.h"
#include <QVBoxLayout>
@@ -66,7 +67,7 @@ void SidebarWidget::newSelection(LibraryType library, ResourceSelection selectio
m_currentWidget = new PublicationWidget();
break;
case Resource_Document:
- m_currentWidget = new PublicationWidget();
+ m_currentWidget = new DocumentWidget();
break;
case Resource_Mail:
m_currentWidget = new PublicationWidget();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic