[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/kdepim-3.5.5+/libkhalkhi/control/libksortedlistbox
From: Friedrich W. H. Kossebau <kossebau () kde ! org>
Date: 2007-02-23 1:24:06
Message-ID: 1172193846.478542.11622.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 636412 by kossebau:
add a third user action button
M +29 -1 branches/work/kdepim-3.5.5+/libkhalkhi/control/libksortedlistbox/ksortedlistbox.cpp
M +6 -2 branches/work/kdepim-3.5.5+/libkhalkhi/control/libksortedlistbox/ksortedlistbox.h
--- branches/work/kdepim-3.5.5+/libkhalkhi/control/libksortedlistbox/ksortedlistbox.cpp #636411:636412
@@ -90,6 +90,16 @@
else
Action2Button = 0;
+ if( Buttons & Action3 )
+ {
+ Action3Button = new QPushButton( this );
+ Action3Button->setEnabled( false );
+ connect( Action3Button, SIGNAL(clicked()), SLOT(action3Item()) );
+ ButtonsLayout->addWidget( Action3Button );
+ }
+ else
+ Action3Button = 0;
+
if( Buttons & Remove )
{
RemoveButton = new QPushButton( i18n("Remove"), this );
@@ -108,6 +118,7 @@
QListBoxItem *KSortedListBox::createItem() { return 0; }
bool KSortedListBox::action1Item( QListBoxItem */*Item*/ ) { return false; }
bool KSortedListBox::action2Item( QListBoxItem */*Item*/ ) { return false; }
+bool KSortedListBox::action3Item( QListBoxItem */*Item*/ ) { return false; }
bool KSortedListBox::deleteItem( QListBoxItem */*Item*/ ) { return false; }
int KSortedListBox::count() const
@@ -135,14 +146,19 @@
Action1Button->setText( Titel );
}
-
void KSortedListBox::setButtonAction2( const QString &Titel )
{
if( Action2Button )
Action2Button->setText( Titel );
}
+void KSortedListBox::setButtonAction3( const QString &Titel )
+{
+ if( Action3Button )
+ Action3Button->setText( Titel );
+}
+
void KSortedListBox::addItem()
{
QListBoxItem* Item = createItem();
@@ -207,6 +223,18 @@
}
}
+void KSortedListBox::action3Item()
+{
+ QListBoxItem *CurrentItem = ListBox->selectedItem();
+
+ if( CurrentItem && action3Item(CurrentItem) )
+ {
+// updateItem( CurrentItem );
+ ListBox->triggerUpdate( true );
+ emit changed( true );
+ }
+}
+
void KSortedListBox::moveUp()
{
if( !ListBox->isEnabled() )
--- branches/work/kdepim-3.5.5+/libkhalkhi/control/libksortedlistbox/ksortedlistbox.h #636411:636412
@@ -22,7 +22,7 @@
#define KSORTEDLISTBOX_H
-// qt
+// Qt
#include <qptrlist.h>
#include <qwidget.h>
@@ -36,7 +36,7 @@
Q_OBJECT
public:
- enum Button { Add=1, UpDown=2, Action1=4, Action2=8, /*Action3=16, */Remove=32 };
+ enum Button { Add=1, UpDown=2, Action1=4, Action2=8, Action3=16, Remove=32 };
public:
KSortedListBox( QWidget *Parent = 0, const char *Name = 0, int Buttons = Add|UpDown|Remove );
@@ -51,6 +51,7 @@
virtual QListBoxItem *createItem();
virtual bool action1Item( QListBoxItem *Item );
virtual bool action2Item( QListBoxItem *Item );
+ virtual bool action3Item( QListBoxItem *Item );
virtual bool deleteItem( QListBoxItem *Item );
protected:
@@ -58,11 +59,13 @@
int count() const;
void setButtonAction1( const QString &Titel );
void setButtonAction2( const QString &Titel );
+ void setButtonAction3( const QString &Titel );
protected slots:
void addItem();
void action1Item();
void action2Item();
+ void action3Item();
void removeItem();
void moveUp();
void moveDown();
@@ -76,6 +79,7 @@
QPushButton *DownButton;
QPushButton *Action1Button;
QPushButton *Action2Button;
+ QPushButton *Action3Button;
QPushButton *RemoveButton;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic