[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/akonadi/clients/akonadiconsole
From: Volker Krause <vkrause () kde ! org>
Date: 2008-08-24 13:38:43
Message-ID: 1219585123.412076.25157.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 851743 by vkrause:
Add a simple Nepomuk property viewer.
M +7 -1 CMakeLists.txt
M +28 -1 browserwidget.cpp
M +1 -0 browserwidget.h
M +78 -5 browserwidget_contentview.ui
--- trunk/KDE/kdepim/akonadi/clients/akonadiconsole/CMakeLists.txt #851742:851743
@@ -1,6 +1,10 @@
include_directories(${CMAKE_SOURCE_DIR}/akonadi)
include_directories(${CMAKE_SOURCE_DIR}/libkdepim)
+find_package( Nepomuk )
+
+if ( NEPOMUK_FOUND )
+
set(akonadiconsole_bin_SRCS
agentwidget.cpp
browserwidget.cpp
@@ -28,8 +32,10 @@
kde4_add_executable(akonadiconsole_bin ${akonadiconsole_bin_SRCS})
set_target_properties(akonadiconsole_bin PROPERTIES OUTPUT_NAME akonadiconsole)
-target_link_libraries( akonadiconsole_bin ${KDE4_AKONADI_LIBS} akonadi-kabc \
${KDE4_AKONADI_KMIME_LIBS} akonadi-kcal kdepim ${KDE4_KDEUI_LIBS} ) \
+target_link_libraries( akonadiconsole_bin ${KDE4_AKONADI_LIBS} akonadi-kabc \
${KDE4_AKONADI_KMIME_LIBS} akonadi-kcal kdepim ${KDE4_KDEUI_LIBS} \
${NEPOMUK_LIBRARIES} )
install( TARGETS akonadiconsole_bin ${INSTALL_TARGETS_DEFAULT_ARGS} )
install( FILES akonadiconsole.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
INSTALL( FILES akonadiconsoleui.rc DESTINATION ${DATA_INSTALL_DIR}/akonadiconsole )
+
+endif ( NEPOMUK_FOUND )
--- trunk/KDE/kdepim/akonadi/clients/akonadiconsole/browserwidget.cpp #851742:851743
@@ -43,6 +43,8 @@
#include <kconfig.h>
#include <kmessagebox.h>
#include <kxmlguiwindow.h>
+#include <nepomuk/resource.h>
+#include <nepomuk/variant.h>
#include <QSplitter>
#include <QTextEdit>
@@ -60,7 +62,8 @@
BrowserWidget::BrowserWidget(KXmlGuiWindow *xmlGuiWindow, QWidget * parent) :
QWidget( parent ),
mItemModel( 0 ),
- mCurrentCollection( 0 )
+ mCurrentCollection( 0 ),
+ mNepomukModel( 0 )
{
QVBoxLayout *layout = new QVBoxLayout( this );
@@ -183,6 +186,30 @@
mAttrModel->itemFromIndex( index )->setFlags( Qt::ItemIsEditable | \
mAttrModel->flags( index ) ); }
contentUi.attrView->setModel( mAttrModel );
+
+ Nepomuk::Resource res( item.url() );
+ delete mNepomukModel;
+ mNepomukModel = 0;
+ if ( res.isValid() ) {
+ QHash<QUrl, Nepomuk::Variant> props = res.properties();
+ mNepomukModel = new QStandardItemModel( props.count(), 2, this );
+ QStringList labels;
+ labels << i18n( "Property" ) << i18n( "Value" );
+ mNepomukModel->setHorizontalHeaderLabels( labels );
+ int row = 0;
+ for ( QHash<QUrl, Nepomuk::Variant>::ConstIterator it = props.begin(); it != \
props.end(); ++it, ++row ) { + QModelIndex index = mNepomukModel->index( row, \
0 ); + Q_ASSERT( index.isValid() );
+ mNepomukModel->setData( index, it.key().toString() );
+ index = mNepomukModel->index( row, 1 );
+ Q_ASSERT( index.isValid() );
+ mNepomukModel->setData( index, it.value().toString() );
+ }
+ contentUi.nepomukView->setEnabled( true );
+ } else {
+ contentUi.nepomukView->setEnabled( false );
+ }
+ contentUi.nepomukView->setModel( mNepomukModel );
}
}
--- trunk/KDE/kdepim/akonadi/clients/akonadiconsole/browserwidget.h #851742:851743
@@ -71,6 +71,7 @@
Akonadi::Collection::Id mCurrentCollection;
Akonadi::Item mCurrentItem;
QStandardItemModel *mAttrModel;
+ QStandardItemModel *mNepomukModel;
};
#endif
--- trunk/KDE/kdepim/akonadi/clients/akonadiconsole/browserwidget_contentview.ui \
#851742:851743 @@ -13,9 +13,17 @@
<item row="0" column="0" colspan="2" >
<widget class="KTabWidget" name="ktabwidget" >
<property name="currentIndex" >
- <number>3</number>
+ <number>0</number>
</property>
<widget class="QWidget" name="tab" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>491</width>
+ <height>428</height>
+ </rect>
+ </property>
<attribute name="title" >
<string>Payload</string>
</attribute>
@@ -29,6 +37,14 @@
<number>0</number>
</property>
<widget class="QWidget" name="unsupportedTypePage" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>483</width>
+ <height>420</height>
+ </rect>
+ </property>
<layout class="QVBoxLayout" >
<item>
<widget class="QLabel" name="unsupportedType" >
@@ -43,16 +59,32 @@
</layout>
</widget>
<widget class="QWidget" name="addresseeViewPage" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>100</width>
+ <height>30</height>
+ </rect>
+ </property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KPIM::AddresseeView" native="1" name="addresseeView" />
+ <widget class="KPIM::AddresseeView" name="addresseeView" />
</item>
</layout>
</widget>
<widget class="QWidget" name="incidenceViewPage" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>100</width>
+ <height>30</height>
+ </rect>
+ </property>
<layout class="QVBoxLayout" >
<item>
- <widget class="Akonadi::KCalItemBrowser" native="1" name="incidenceView" \
/> + <widget class="Akonadi::KCalItemBrowser" name="incidenceView" />
</item>
</layout>
</widget>
@@ -61,6 +93,14 @@
</layout>
</widget>
<widget class="QWidget" name="tab_4" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>491</width>
+ <height>428</height>
+ </rect>
+ </property>
<attribute name="title" >
<string>Attributes</string>
</attribute>
@@ -74,7 +114,7 @@
</item>
<item row="1" column="0" >
<widget class="KLineEdit" name="attrName" >
- <property name="clickMessage" stdset="0" >
+ <property name="clickMessage" >
<string>New Attribute</string>
</property>
</widget>
@@ -96,6 +136,14 @@
</layout>
</widget>
<widget class="QWidget" name="tab_2" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>491</width>
+ <height>428</height>
+ </rect>
+ </property>
<attribute name="title" >
<string>Raw Payload</string>
</attribute>
@@ -113,6 +161,14 @@
</layout>
</widget>
<widget class="QWidget" name="tab_3" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>491</width>
+ <height>428</height>
+ </rect>
+ </property>
<attribute name="title" >
<string>Internals</string>
</attribute>
@@ -248,6 +304,23 @@
</item>
</layout>
</widget>
+ <widget class="QWidget" name="tab_5" >
+ <attribute name="title" >
+ <string>Nepomuk</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout" >
+ <item>
+ <widget class="QTreeView" name="nepomukView" >
+ <property name="rootIsDecorated" >
+ <bool>false</bool>
+ </property>
+ <property name="allColumnsShowFocus" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
</widget>
</item>
<item row="1" column="0" >
@@ -255,7 +328,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic