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

List:       kde-core-devel
Subject:    Re: KListViewSearchLine
From:       Scott Wheeler <wheeler () kde ! org>
Date:       2004-02-16 2:00:51
Message-ID: 200402160300.56204.wheeler () kde ! org
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 16 February 2004 2:51, Scott Wheeler wrote:
> and a small change to KListView to provide some useful signals

Here's a slightly more paranoid version of the KListView patch -- notably 
because KMail crashed when I tried to close it a few minutes ago.  :-)

- -Scott

- -- 
For a successful technology, reality must take precedence over public 
relations, for nature cannot be fooled. 
- --Richard Feynman
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQFAMCRWQu0ByfY5QTkRAlRiAJ9EV/PtqNTb7G6uI+8Raj5hWC91GgCdHCzj
9bgpLEB2lj1dpgSizb4xHOE=
=xzKv
-----END PGP SIGNATURE-----

["kdeui-listviewsearchline.patch" (text/x-diff)]

? klistviewsearchline.cpp
? klistviewsearchline.h
? log
Index: Makefile.am
===================================================================
RCS file: /home/kde/kdelibs/kdeui/Makefile.am,v
retrieving revision 1.324
diff -u -3 -p -r1.324 Makefile.am
--- Makefile.am	20 Jan 2004 22:04:19 -0000	1.324
+++ Makefile.am	16 Feb 2004 01:58:39 -0000
@@ -68,7 +68,7 @@ include_HEADERS = kprogress.h kcolordlg.
 		kdatetimewidget.h ktimewidget.h \
 		kspell.h ksconfig.h kspelldlg.h ksyntaxhighlighter.h \
 		ktabbar.h ktabwidget.h ksplashscreen.h kconfigdialog.h \
-		kactionselector.h klanguagebutton.h
+		kactionselector.h klanguagebutton.h klistviewsearchline.h
 
 # the order of the sources isn't randomly (at least not completely).
 # the order is predictated by the use of X11 header files
@@ -115,7 +115,7 @@ libkdeui_la_SOURCES = \
 		ksconfig.cpp kspelldlg.cpp \
 		kspell.cpp ksyntaxhighlighter.cpp ktabbar.cpp ktabwidget.cpp \
 		ksplashscreen.cpp kspellui.ui kconfigdialog.cpp \
-		kactionselector.cpp klanguagebutton.cpp
+		kactionselector.cpp klanguagebutton.cpp klistviewsearchline.cpp
 
 noinst_HEADERS = kdockwidget_private.h kdockwidget_p.h klistviewlineedit.h \
 		kdialogbase_priv.h kaboutdialog_private.h kcursor_private.h \
Index: klistview.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/klistview.cpp,v
retrieving revision 1.212
diff -u -3 -p -r1.212 klistview.cpp
--- klistview.cpp	20 Dec 2003 17:01:32 -0000	1.212
+++ klistview.cpp	16 Feb 2004 01:58:40 -0000
@@ -2091,6 +2091,8 @@ KListViewItem::KListViewItem(QListViewIt
 
 KListViewItem::~KListViewItem()
 {
+  if(listView())
+    emit static_cast<KListView *>(listView())->itemRemoved(this);
 }
 
 void KListViewItem::init()
@@ -2098,6 +2100,21 @@ void KListViewItem::init()
   m_odd = m_known = false;
   KListView *lv = static_cast<KListView *>(listView());
   setDragEnabled( dragEnabled() || lv->dragEnabled() );
+  emit lv->itemAdded(this);
+}
+
+void KListViewItem::insertItem(QListViewItem *item)
+{
+  QListViewItem::insertItem(item);
+  if(listView())
+    emit static_cast<KListView *>(listView())->itemAdded(item);
+}
+
+void KListViewItem::takeItem(QListViewItem *item)
+{
+  QListViewItem::takeItem(item);
+  if(listView())
+    emit static_cast<KListView *>(listView())->itemRemoved(item);
 }
 
 const QColor &KListViewItem::backgroundColor()
Index: klistview.h
===================================================================
RCS file: /home/kde/kdelibs/kdeui/klistview.h,v
retrieving revision 1.118
diff -u -3 -p -r1.118 klistview.h
--- klistview.h	20 Dec 2003 17:01:32 -0000	1.118
+++ klistview.h	16 Feb 2004 01:58:40 -0000
@@ -543,6 +543,9 @@ signals:
    */
   void contextMenu (KListView* l, QListViewItem* i, const QPoint& p);
 
+  void itemAdded(QListViewItem *item);
+  void itemRemoved(QListViewItem *item);
+
 public slots:
   /**
    * Rename column @p c of @p item.
@@ -1023,6 +1026,9 @@ public:
 
   virtual ~KListViewItem();
 
+  virtual void insertItem(QListViewItem *item);
+  virtual void takeItem(QListViewItem *item);
+
   /**
    * returns true if this item is to be drawn with the alternate background
    */


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

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