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

List:       kde-commits
Subject:    KDE/kdepim/kleopatra/view
From:       Marc Mutz <mutz () kde ! org>
Date:       2010-11-03 22:51:40
Message-ID: 20101103225140.21CA6AC89E () svn ! kde ! org
[Download RAW message or body]

SVN commit 1192769 by mutz:

KeyTreeView: add convenience methods (dis)connectSearchBar()

 M  +26 -0     keytreeview.cpp  
 M  +3 -0      keytreeview.h  


--- trunk/KDE/kdepim/kleopatra/view/keytreeview.cpp #1192768:1192769
@@ -351,4 +351,30 @@
 
 }
 
+static const struct {
+    const char * signal;
+    const char * slot;
+} connections[] = {
+    { SIGNAL(stringFilterChanged(QString)),
+      SLOT(setStringFilter(QString)) },
+    { SIGNAL(keyFilterChanged(boost::shared_ptr<Kleo::KeyFilter>)),
+      SLOT(setKeyFilter(boost::shared_ptr<Kleo::KeyFilter>)) },
+};
+static const unsigned int numConnections = sizeof connections / sizeof *connections ;
+
+void KeyTreeView::disconnectSearchBar( const QObject * bar ) {
+    for ( unsigned int i = 0 ; i < numConnections ; ++i ) {
+        disconnect( this, connections[i].signal, bar,  connections[i].slot );
+        disconnect( bar,  connections[i].signal, this, connections[i].slot );
+    }
+}
+
+bool KeyTreeView::connectSearchBar( const QObject * bar ) {
+    for ( unsigned int i = 0 ; i < numConnections ; ++i )
+        if ( !connect( this, connections[i].signal, bar,  connections[i].slot ) ||
+             !connect( bar,  connections[i].signal, this, connections[i].slot ) )
+            return false;
+    return true;
+}
+
 #include "moc_keytreeview.cpp"
--- trunk/KDE/kdepim/kleopatra/view/keytreeview.h #1192768:1192769
@@ -97,6 +97,9 @@
 
         virtual KeyTreeView * clone() const { return new KeyTreeView( *this ); }
 
+        void disconnectSearchBar( const QObject * bar );
+        bool connectSearchBar( const QObject * bar );
+
     public Q_SLOTS:
         virtual void setStringFilter( const QString & text );
         virtual void setKeyFilter( const boost::shared_ptr<Kleo::KeyFilter> & filter );
[prev in list] [next in list] [prev in thread] [next in thread] 

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