[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/base/nepomuk-kde/annotation/lib/gui
From:       Sebastian Trueg <sebastian () trueg ! de>
Date:       2011-02-17 13:41:20
Message-ID: 20110217134120.8ECF7AC8BE () svn ! kde ! org
[Download RAW message or body]

SVN commit 1221286 by trueg:

Added rich text editing to the resource editor

 M  +25 -0     resourceeditor.cpp  
 M  +25 -5     resourceeditor.ui  


--- trunk/playground/base/nepomuk-kde/annotation/lib/gui/resourceeditor.cpp #1221285:1221286
@@ -34,6 +34,8 @@
 #include <krun.h>
 #include <kicon.h>
 #include <krichtextwidget.h>
+#include <kactioncollection.h>
+#include <kdebug.h>
 
 #include <kratingwidget.h>
 #include <Nepomuk/ResourceManager>
@@ -48,6 +50,9 @@
 #include <QtGui/QStackedWidget>
 #include <QtGui/QListWidget>
 #include <QtGui/QListWidgetItem>
+#include <QtGui/QToolButton>
+#include <QtGui/QWidgetAction>
+#include <QtGui/QToolBar>
 #include <QtCore/QProcess>
 
 #include <Soprano/Util/SignalCacheModel>
@@ -214,6 +219,26 @@
     d->q = this;
     d->setupUi( this );
 
+    // create the action buttons
+    QHBoxLayout* toolBarLayout = new QHBoxLayout(d->m_toolBar);
+    toolBarLayout->setMargin(0);
+    QToolBar* toolBar = new QToolBar(d->m_toolBar);
+    toolBar->setIconSize(QSize(16, 16));
+    toolBarLayout->addWidget(toolBar);
+    KActionCollection* actionCollection = new KActionCollection(this);
+    d->m_descriptionEditor->createActions(actionCollection);
+    Q_FOREACH(QAction* action, actionCollection->actions()) {
+
+        // Hack to exclude some actions
+        if(action->objectName() == "direction_ltr" ||
+                action->objectName() == "direction_rtl" ||
+                action->objectName() == "manage_link" ||
+                action->objectName() == "action_to_plain_text")
+            continue;
+
+        toolBar->addAction(action);
+    }
+
     // connect the gui
     connect(d->m_labelEdit, SIGNAL(textChanged(QString)),
             this, SIGNAL(annotationsChanged()));
--- trunk/playground/base/nepomuk-kde/annotation/lib/gui/resourceeditor.ui #1221285:1221286
@@ -10,7 +10,10 @@
     <height>419</height>
    </rect>
   </property>
-  <layout class="QHBoxLayout" name="horizontalLayout">
+  <layout class="QVBoxLayout" name="verticalLayout_3">
+   <property name="margin">
+    <number>0</number>
+   </property>
    <item>
     <widget class="QSplitter" name="splitter_2">
      <property name="orientation">
@@ -23,7 +26,7 @@
          <item>
           <widget class="QLabel" name="label">
            <property name="text">
-            <string>Title</string>
+            <string>Title:</string>
            </property>
           </widget>
          </item>
@@ -46,15 +49,32 @@
          <property name="orientation">
           <enum>Qt::Horizontal</enum>
          </property>
-         <widget class="KRichTextWidget" name="m_descriptionEditor"/>
-         <widget class="QWidget" name="layoutWidget">
+         <widget class="QWidget" name="">
           <layout class="QVBoxLayout" name="verticalLayout">
            <item>
-            <widget class="QListWidget" name="m_relationView"/>
+            <widget class="QWidget" name="m_toolBar" native="true"/>
            </item>
+           <item>
+            <widget class="KRichTextWidget" name="m_descriptionEditor">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+               <horstretch>1</horstretch>
+               <verstretch>1</verstretch>
+              </sizepolicy>
+             </property>
+            </widget>
+           </item>
           </layout>
          </widget>
+         <widget class="QListWidget" name="m_relationView">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+            <horstretch>0</horstretch>
+            <verstretch>1</verstretch>
+           </sizepolicy>
+          </property>
         </widget>
+        </widget>
        </item>
       </layout>
      </widget>
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic