[prev in list] [next in list] [prev in thread] [next in thread]
List: kmail-devel
Subject: another address book patch
From: Daniel Naber <dnaber () mini ! gt ! owl ! de>
Date: 2000-05-01 18:02:40
[Download RAW message or body]
Hi,
this patch requires the other address book patch I recently sent. It
basically disables buttons as long as they have no function anyway. I think
that makes using the dialog easier.
Regards
Daniel
["address-dialog-2.diff" (text/plain)]
--- kmaddrbookdlg.h.bak Mon May 1 17:43:46 2000
+++ kmaddrbookdlg.h Mon May 1 18:11:53 2000
@@ -52,7 +52,9 @@
protected slots:
void slotOk();
void slotCancel();
+ void slotEnableAdd();
void slotAdd();
+ void slotEnableRemove();
void slotRemove();
void slotLbxHighlighted(const QString& item);
--- kmaddrbookdlg.cpp.bak Mon May 1 17:22:38 2000
+++ kmaddrbookdlg.cpp Mon May 1 18:11:44 2000
@@ -49,7 +49,7 @@
{
mListBox.insertItem(addr);
}
- resize(300, 450);
+ resize(350, 450);
}
@@ -118,8 +118,10 @@
mBtnCancel.setMinimumSize(mBtnCancel.size());
mBtnAdd.adjustSize();
mBtnAdd.setMinimumSize(mBtnAdd.size());
+ mBtnAdd.setEnabled(false);
mBtnRemove.adjustSize();
mBtnRemove.setMinimumSize(mBtnRemove.size());
+ mBtnRemove.setEnabled(false);
mGrid.addMultiCellWidget(&mListBox, 0, 0, 0, 3);
mGrid.addMultiCellWidget(&mEdtAddress, 1, 1, 0, 3);
@@ -143,11 +145,14 @@
connect(&mBtnCancel, SIGNAL(clicked()), SLOT(slotCancel()));
connect(&mBtnAdd, SIGNAL(clicked()), SLOT(slotAdd()));
connect(&mBtnRemove, SIGNAL(clicked()), SLOT(slotRemove()));
+ connect(&mEdtAddress, SIGNAL(textChanged(const QString&)), SLOT(slotEnableAdd()));
+ connect(&mListBox, SIGNAL(selectionChanged()), SLOT(slotEnableRemove()));
for (addr=mAddrBook->first(); addr; addr=mAddrBook->next())
{
mListBox.insertItem(addr);
}
+ resize(350, 450);
}
@@ -160,6 +165,9 @@
//-----------------------------------------------------------------------------
void KMAddrBookEditDlg::slotLbxHighlighted(const QString& aItem)
{
+
+ mBtnRemove.setEnabled(true);
+
int oldIndex = mIndex;
disconnect(&mListBox, SIGNAL(highlighted(const QString&)),
this, SLOT(slotLbxHighlighted(const QString&)));
@@ -212,6 +220,13 @@
//-----------------------------------------------------------------------------
+void KMAddrBookEditDlg::slotEnableAdd()
+{
+ mBtnAdd.setEnabled(true);
+}
+
+
+//-----------------------------------------------------------------------------
void KMAddrBookEditDlg::slotAdd()
{
const char* addr = mEdtAddress.text();
@@ -223,6 +238,13 @@
//-----------------------------------------------------------------------------
+void KMAddrBookEditDlg::slotEnableRemove()
+{
+ mBtnRemove.setEnabled(true);
+}
+
+
+//-----------------------------------------------------------------------------
void KMAddrBookEditDlg::slotRemove()
{
int idx = mListBox.currentItem();
@@ -230,6 +252,9 @@
if (idx >= 0) mListBox.removeItem(idx);
if (idx >= (int)mListBox.count()) idx--;
mListBox.setCurrentItem(idx);
+ if( mListBox.count() == 0 ) {
+ mBtnRemove.setEnabled(false);
+ }
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic