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

List:       quanta-devel
Subject:    [quanta-devel] branches/work/kdevquanta/lib
From:       Andras Mantia <amantia () kde ! org>
Date:       2006-04-19 20:57:49
Message-ID: 1145480269.508313.13283.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 531694 by amantia:

The kdevquanta lib compiles and links now with the current kdelibs4_snapshot.

CCMAIL: quanta-devel@kde.org

 M  +1 -1      CMakeLists.txt  
 M  +31 -40    basetreeview.cpp  
 M  +7 -0      basetreeview.h  
 M  +6 -9      extfileinfo.cpp  
 M  +8 -1      extfileinfo.h  
 M  +5 -6      useraction.cpp  
 M  +4 -0      useraction.h  


--- branches/work/kdevquanta/lib/CMakeLists.txt #531693:531694
@@ -37,7 +37,7 @@
 
 kde4_add_library(kdevquanta SHARED ${kdevquanta_LIB_SRCS})
 
-target_link_libraries(kdevquanta  ${KDE4_KDECORE_LIBS} )
+target_link_libraries(kdevquanta kdevinterfaces ktexteditor ${KDE4_KIO_LIBS})
 
 set_target_properties(kdevquanta PROPERTIES VERSION 1.0.0 SOVERSION 1 )
 install_targets(${LIB_INSTALL_DIR} kdevquanta )
--- branches/work/kdevquanta/lib/basetreeview.cpp #531693:531694
@@ -24,6 +24,7 @@
 
 // QT includes
 #include <QDropEvent>
+#include <QHelpEvent>
 
 #include <qeventloop.h>
 #include <qlayout.h>
@@ -67,44 +68,6 @@
 
 #include <X11/Xlib.h>
 
-
-class BaseTreeViewToolTip : public QToolTip
-{
-public:
-    BaseTreeViewToolTip( QWidget *parent, BaseTreeView *lv )
-        : QToolTip( parent ), m_view( lv ) {}
-
-    void maybeTip( const QPoint &pos )
-    {
-        if ( !parentWidget() || !m_view || !m_view->showToolTips() )
-        return;
-    
-        Q3ListViewItem *item = m_view->itemAt(pos);
-        if (!item)
-          return;
-        QString text;
-        KFileTreeViewItem * kftvi = dynamic_cast<BaseTreeViewItem *> (item);
-        if (kftvi) {
-          QString desc = kftvi->text(1);
-          text = kftvi->fileItem()->getToolTipText();
-          if ( !desc.isEmpty() )
-            text.prepend("&nbsp;<i>" + desc + "</i><br>");
-        } else
-        {  // show something for the branchroot
-          text = item->text(0);
-          if ( ! item->text(1).isEmpty() )
-            text.append( "<br>" + item->text(1));
-        }
-        if ( !text.isEmpty() )
-          tip(m_view->itemRect(item), text);
-    }
-
-private:
-    BaseTreeView *m_view;
-};
-
-
-
 //BaseTreeViewItem implementation
 BaseTreeViewItem::BaseTreeViewItem( KFileTreeViewItem *parent, KFileItem* item, \
KFileTreeBranch *brnch )  : KFileTreeViewItem( parent, item, brnch)
@@ -292,8 +255,6 @@
 BaseTreeView::BaseTreeView(KDevPlugin *plugin, QWidget * parent)
   : KFileTreeView(parent), fileInfoDlg(0), m_parent(parent), m_plugin(plugin), \
m_saveOpenFolder(false), m_partController(plugin ? plugin->documentController() : 0)  \
                {
-  QToolTip::remove(viewport());  // remove the tooltip from QListView
-  m_tooltip = new BaseTreeViewToolTip(viewport(), this);
 //   setTreeStepSize(15);
   setRootIsDecorated(false);
   setSorting(0);
@@ -490,7 +451,37 @@
   return quantaFileProperties;
 }
 
+bool BaseTreeView::event(QEvent *event)
+{  
+  if (event->type() == QEvent::ToolTip)
+  {
+    if (!showToolTips() )
+      return true;
+    
+    Q3ListViewItem *item = itemAt(static_cast<QHelpEvent*>(event)->globalPos());
+    if (!item)
+      return true;
+    QString text;
+    KFileTreeViewItem * kftvi = dynamic_cast<BaseTreeViewItem *> (item);
+    if (kftvi) {
+      QString desc = kftvi->text(1);
+      text = kftvi->fileItem()->getToolTipText();
+      if ( !desc.isEmpty() )
+        text.prepend("&nbsp;<i>" + desc + "</i><br>");
+    } else
+    {  // show something for the branchroot
+      text = item->text(0);
+      if ( ! item->text(1).isEmpty() )
+        text.append( "<br>" + item->text(1));
+    }
+    if (!text.isEmpty() )
+      QToolTip::showText(static_cast<QHelpEvent*>(event)->globalPos(), text);
+    return true;
+  }
+  return false;
+}
 
+
 void BaseTreeView::slotClose()
 {
   if (currentItem())
--- branches/work/kdevquanta/lib/basetreeview.h #531693:531694
@@ -325,6 +325,13 @@
   virtual FileInfoDlg* addFileInfoPage(KPropertiesDialog *propDlg);
 
   /**
+   * Reimplemented to handle the tooltip event.
+   * @param event 
+   * @return 
+   */
+  virtual bool event(QEvent *event);
+
+  /**
   expands an archiv inside of the tree
   @return true if expanding was possible
   */
--- branches/work/kdevquanta/lib/extfileinfo.cpp #531693:531694
@@ -391,13 +391,10 @@
 
 void ExtFileInfo::enter_loop()
 {
-  QWidget dummy(0, 0, Qt::WType_Dialog | Qt::WShowModal);
-  dummy.setFocusPolicy( Qt::NoFocus );
-  qt_enter_modal(&dummy);
-  //kdDebug(24000)<<"ExtFileInfo::enter_loop:before qApp->enter_loop()"<< endl;
-  qApp->enter_loop();
-//  kdDebug(24000)<<"ExtFileInfo::enter_loop:after qApp->enter_loop()"<<endl;
-  qt_leave_modal(&dummy);
+  QEventLoop eventLoop;
+  connect(this, SIGNAL(leaveModality()),
+          &eventLoop, SLOT(quit()));
+  eventLoop.exec(QEventLoop::ExcludeUserInputEvents);
 }
 
 void ExtFileInfo::slotListResult(KIO::Job *job)
@@ -418,7 +415,7 @@
   }
   if ( job->isA("KIO::StatJob") )
     m_entry = static_cast<KIO::StatJob *>(job)->statResult();
-  qApp->exit_loop();
+  emit leaveModality();
 }
 
 void ExtFileInfo::slotNewEntries(KIO::Job *job, const KIO::UDSEntryList& udsList)
@@ -546,7 +543,7 @@
 void ExtFileInfo::slotTimeout()
 {
   bJobOK = false;
-  qApp->exit_loop();
+  emit leaveModality();
 }
 
 
--- branches/work/kdevquanta/lib/extfileinfo.h #531693:531694
@@ -101,13 +101,20 @@
   
   /** Reenters the event loop. You must call qApp->exit_loop() to exit it. */
   void enter_loop();
+
+  /**
+   * Exits the reentered event loop.
+   */
+  void exit_loop() { emit leaveModality();}
   
   /** Set's up the url correctly from urlString. 
    *  If urlString does contain a relative path this is equal to 
    */
   static void setUrl(KUrl &url, const QString& urlString);
+  
+Q_SIGNALS:
+  void leaveModality();
 
-
 private:
   /** Internal methods called by the above ones. They start their own event loop and
       exit when the even loop is exited */
--- branches/work/kdevquanta/lib/useraction.cpp #531693:531694
@@ -290,8 +290,8 @@
 //FIXME       ViewManager::ref()->activeView()->setFocus();
       if (m_loopStarted)
       {
-          qApp->exit_loop();
-          m_loopStarted = false;
+         emit internalFileInfo.exit_loop();
+         m_loopStarted = false;
       }
       return false;
     }
@@ -330,7 +330,7 @@
 {
   if (m_loopStarted)
   {
-    qApp->exit_loop();
+    emit internalFileInfo.exit_loop();
     m_loopStarted = false;
   }
   delete process;
@@ -355,7 +355,6 @@
         timer = new QTimer(this);
         connect(timer, SIGNAL(timeout()), SLOT(slotTimeout()));
         timer->start(180*1000, true);
-        ExtFileInfo internalFileInfo;
         m_loopStarted = true;
         m_killCount = 0;
         internalFileInfo.enter_loop();
@@ -405,8 +404,8 @@
     ::kill(-proc->pid(), SIGKILL);
     if (m_loopStarted)
     {
-        qApp->exit_loop();
-        m_loopStarted = false;
+      emit internalFileInfo.exit_loop();
+      m_loopStarted = false;
     }
     return;
   }
--- branches/work/kdevquanta/lib/useraction.h #531693:531694
@@ -19,11 +19,14 @@
 #include <qdom.h>
 #include <kaction.h>
 
+#include "extfileinfo.h"
+
 class KDevPlugin;
 class KProcess;
 class QFile;
 class QTimer;
 
+
 /**
  * An action for inserting an XML tag, a text or start an external script.
  *
@@ -111,6 +114,7 @@
     QStringList m_argsList;
     uint m_killCount;
     bool const m_toggle;
+    ExtFileInfo internalFileInfo;
 };
 
 
_______________________________________________
quanta-devel mailing list
quanta-devel@kde.org
https://mail.kde.org/mailman/listinfo/quanta-devel


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

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