summaryrefslogtreecommitdiffabout
path: root/kabc/addresseedialog.cpp
Side-by-side diff
Diffstat (limited to 'kabc/addresseedialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseedialog.cpp80
1 files changed, 61 insertions, 19 deletions
diff --git a/kabc/addresseedialog.cpp b/kabc/addresseedialog.cpp
index 648e780..19b52bb 100644
--- a/kabc/addresseedialog.cpp
+++ b/kabc/addresseedialog.cpp
@@ -105,51 +105,52 @@ AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) :
new QLabel ( i18n("Selected:"), selectedGroup );
//selectedLayout->addWidget( selectedGroup );
mSelectedList = new KListView( selectedGroup );
mSelectedList->addColumn( i18n("Name") );
mSelectedList->addColumn( i18n("Email") );
mSelectedList->setAllColumnsShowFocus( true );
mSelectedList->setFullWidth( true );
connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ),
SLOT( removeSelected() ) );
QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup );
connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) );
connect( mAddresseeList, SIGNAL( clicked( QListViewItem * ) ),
SLOT( addSelected( QListViewItem * ) ) );
connect( mAddresseeList, SIGNAL( returnPressed( QListViewItem * ) ),
SLOT( selectNextItem( QListViewItem * ) ) );
}
mAddressBook = StdAddressBook::self( true );
connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook* ) ),
SLOT( addressBookChanged() ) );
+#if 0
connect( mAddressBook, SIGNAL( loadingFinished( Resource* ) ),
SLOT( addressBookChanged() ) );
-
+#endif
loadAddressBook();
QValueList<int> splitterSize;
splitterSize.append( ( width() / 5 ) * 3 );
splitterSize.append( ( width() / 5 ) *2 );
mMiniSplitter->setSizes( splitterSize );
}
AddresseeDialog::~AddresseeDialog()
{
qDebug("DELETE AddresseeDialog ");
}
void AddresseeDialog::loadAddressBook()
{
mAddresseeList->clear();
mItemDict.clear();
if ( mAddresseeEdit->text().isEmpty() ) {
AddressBook::Iterator it;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
continue;
new AddresseeItem( mAddresseeList, (*it) );
}
return;
@@ -257,55 +258,96 @@ Addressee AddresseeDialog::addressee()
Addressee::List AddresseeDialog::addressees()
{
Addressee::List al;
AddresseeItem *aItem = 0;
if ( mMultiple ) {
QListViewItem *item = mSelectedList->firstChild();
while( item ) {
aItem = (AddresseeItem *)( item );
if ( aItem ) al.append( aItem->addressee() );
item = item->nextSibling();
}
}
else
{
aItem = (AddresseeItem *)( mAddresseeList->selectedItem() );
if (aItem) al.append( aItem->addressee() );
}
return al;
}
Addressee AddresseeDialog::getAddressee( QWidget *parent )
{
- AddresseeDialog *dlg = new AddresseeDialog( parent );
- Addressee addressee;
- int result = dlg->exec();
+ AddresseeDialog *dlg = new AddresseeDialog( parent );
+ Addressee addressee;
+#ifdef DESKTOP_VERSION
+ static int geoX = 0;
+ static int geoY = 0;
+ static int geoW = 0;
+ static int geoH = 0;
+ if ( !geoX && ! geoY && !geoW &&!geoH ) {
+ geoX = dlg->geometry().x();
+ geoY = dlg->geometry().y();
+ geoW = dlg->width();
+ geoH = dlg->height();
+ } else {
+ dlg->show();
+ dlg->setGeometry(geoX , geoY,geoW , geoH );
- if ( result == QDialog::Accepted ) {
- addressee = dlg->addressee();
- }
+ }
+#endif
+ int result = dlg->exec();
+#ifdef DESKTOP_VERSION
+ geoX = dlg->geometry().x();
+ geoY = dlg->geometry().y();
+ geoW = dlg->width();
+ geoH = dlg->height();
+#endif
+ if ( result == QDialog::Accepted ) {
+ addressee = dlg->addressee();
+ }
- delete dlg;
- return addressee;
+ delete dlg;
+ return addressee;
}
Addressee::List AddresseeDialog::getAddressees( QWidget *parent )
{
- AddresseeDialog *dlg = new AddresseeDialog( parent, true );
- Addressee::List addressees;
- if ( QApplication::desktop()->width() <= 640 )
- dlg->showMaximized();
- int result = dlg->exec();
- if ( result == QDialog::Accepted ) {
- addressees = dlg->addressees();
- }
+ AddresseeDialog *dlg = new AddresseeDialog( parent, true );
+ Addressee::List addressees;
+ static int geoX = 0;
+ static int geoY = 0;
+ static int geoW = 0;
+ static int geoH = 0;
+ if ( QApplication::desktop()->width() <= 640 )
+ dlg->showMaximized();
+ else {
+ if ( !geoX && ! geoY && !geoW &&!geoH ) {
+ geoX = dlg->geometry().x();
+ geoY = dlg->geometry().y();
+ geoW = dlg->width();
+ geoH = dlg->height();
+ } else {
+ dlg->show();
+ dlg->setGeometry(geoX , geoY,geoW , geoH );
+
+ }
+ }
+ int result = dlg->exec();
+ geoX = dlg->geometry().x();
+ geoY = dlg->geometry().y();
+ geoW = dlg->width();
+ geoH = dlg->height();
+ if ( result == QDialog::Accepted ) {
+ addressees = dlg->addressees();
+ }
- delete dlg;
- return addressees;
+ delete dlg;
+ return addressees;
}
void AddresseeDialog::addressBookChanged()
{
loadAddressBook();
}