From 2cb1d1c8edcbfae77e25dad2f3aa97e09c627a06 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 2 Feb 2013 13:42:48 -0600 Subject: Fix unintended renaming --- .../kopete/addcontactwizard/addcontactwizard.cpp | 2 +- .../config/identity/kopeteidentityconfig.cpp | 2 +- kopete/kopete/contactlist/kopetelviprops.cpp | 2 +- kopete/libkopete/ui/CMakeLists.txt | 8 +- kopete/libkopete/ui/Makefile.am | 6 +- kopete/libkopete/ui/addressbooklinkwidget.cpp | 4 +- kopete/libkopete/ui/addressbookselectordialog.cpp | 89 +++++++++++ kopete/libkopete/ui/addressbookselectordialog.h | 91 +++++++++++ kopete/libkopete/ui/addressbookselectorwidget.cpp | 171 ++++++++++++++++++++ kopete/libkopete/ui/addressbookselectorwidget.h | 91 +++++++++++ .../libkopete/ui/addressbookselectorwidget_base.ui | 175 +++++++++++++++++++++ .../libkopete/ui/addressbootdeselectordialog.cpp | 89 ----------- kopete/libkopete/ui/addressbootdeselectordialog.h | 91 ----------- .../libkopete/ui/addressbootdeselectorwidget.cpp | 171 -------------------- kopete/libkopete/ui/addressbootdeselectorwidget.h | 91 ----------- .../ui/addressbootdeselectorwidget_base.ui | 175 --------------------- kopete/libkopete/ui/contactaddednotifydialog.cpp | 2 +- 17 files changed, 630 insertions(+), 630 deletions(-) create mode 100644 kopete/libkopete/ui/addressbookselectordialog.cpp create mode 100644 kopete/libkopete/ui/addressbookselectordialog.h create mode 100644 kopete/libkopete/ui/addressbookselectorwidget.cpp create mode 100644 kopete/libkopete/ui/addressbookselectorwidget.h create mode 100644 kopete/libkopete/ui/addressbookselectorwidget_base.ui delete mode 100644 kopete/libkopete/ui/addressbootdeselectordialog.cpp delete mode 100644 kopete/libkopete/ui/addressbootdeselectordialog.h delete mode 100644 kopete/libkopete/ui/addressbootdeselectorwidget.cpp delete mode 100644 kopete/libkopete/ui/addressbootdeselectorwidget.h delete mode 100644 kopete/libkopete/ui/addressbootdeselectorwidget_base.ui diff --git a/kopete/kopete/addcontactwizard/addcontactwizard.cpp b/kopete/kopete/addcontactwizard/addcontactwizard.cpp index 5e461f53..97907246 100644 --- a/kopete/kopete/addcontactwizard/addcontactwizard.cpp +++ b/kopete/kopete/addcontactwizard/addcontactwizard.cpp @@ -63,7 +63,7 @@ #include #include -#include "addressbootdeselectorwidget.h" +#include "addressbookselectorwidget.h" #include "addcontactwizard.h" #include "kopetecontactlist.h" #include "kopetemetacontact.h" diff --git a/kopete/kopete/config/identity/kopeteidentityconfig.cpp b/kopete/kopete/config/identity/kopeteidentityconfig.cpp index 0f28e403..1d513964 100644 --- a/kopete/kopete/config/identity/kopeteidentityconfig.cpp +++ b/kopete/kopete/config/identity/kopeteidentityconfig.cpp @@ -60,7 +60,7 @@ #include "kopeteaccount.h" #include "kopetecontact.h" #include "kopetecontactlist.h" -#include "addressbootdeselectordialog.h" +#include "addressbookselectordialog.h" #include "kopeteconfig.h" // Local includes diff --git a/kopete/kopete/contactlist/kopetelviprops.cpp b/kopete/kopete/contactlist/kopetelviprops.cpp index 6a3f0ba1..f64af84d 100644 --- a/kopete/kopete/contactlist/kopetelviprops.cpp +++ b/kopete/kopete/contactlist/kopetelviprops.cpp @@ -54,7 +54,7 @@ #include "kopeteaccount.h" #include "kopeteprotocol.h" #include "addressbooklinkwidget.h" -#include "addressbootdeselectordialog.h" +#include "addressbookselectordialog.h" #include "customnotificationprops.h" #include "customnotifications.h" diff --git a/kopete/libkopete/ui/CMakeLists.txt b/kopete/libkopete/ui/CMakeLists.txt index d3016386..cb224847 100644 --- a/kopete/libkopete/ui/CMakeLists.txt +++ b/kopete/libkopete/ui/CMakeLists.txt @@ -28,8 +28,8 @@ install( FILES addressbooklinkwidget.h kopetefileconfirmdialog.h kopetepasswordwidget.h kopeteview.h addcontactpage.h kopeteviewplugin.h editaccountwidget.h kopetecontactaction.h - kopetestdaction.h userinfodialog.h addressbootdeselectordialog.h - addressbootdeselectorwidget.h kopetelistview.h accountselector.h + kopetestdaction.h userinfodialog.h addressbookselectordialog.h + addressbookselectorwidget.h kopetelistview.h accountselector.h kopetelistviewitem.h kopetelistviewsearchline.h ${CMAKE_CURRENT_BINARY_DIR}/fileconfirmbase.h ${CMAKE_CURRENT_BINARY_DIR}/kopeteawaydialogbase.h @@ -47,8 +47,8 @@ tde_add_library( kopeteui STATIC_PIC AUTOMOC kopetefileconfirmdialog.cpp fileconfirmbase.ui userinfodialog.cpp kopeteview.cpp kopetepasswordwidgetbase.ui kopetepasswordwidget.cpp accountselector.cpp kopeteviewplugin.cpp - addresseeitem.cpp addressbootdeselectorwidget_base.ui - addressbootdeselectordialog.cpp addressbootdeselectorwidget.cpp + addresseeitem.cpp addressbookselectorwidget_base.ui + addressbookselectordialog.cpp addressbookselectorwidget.cpp metacontactselectorwidget_base.ui metacontactselectorwidget.cpp kopetelistview.cpp kopetelistviewitem.cpp kopetelistviewsearchline.cpp contactaddednotifywidget.ui contactaddednotifydialog.cpp diff --git a/kopete/libkopete/ui/Makefile.am b/kopete/libkopete/ui/Makefile.am index 8bb377bb..3e88846d 100644 --- a/kopete/libkopete/ui/Makefile.am +++ b/kopete/libkopete/ui/Makefile.am @@ -8,8 +8,8 @@ libkopeteui_la_SOURCES = kopetecontactaction.cpp addcontactpage.cpp \ editaccountwidget.cpp kopetepassworddialog.ui kopetestdaction.cpp kopeteawaydialogbase.ui \ kopetefileconfirmdialog.cpp fileconfirmbase.ui userinfodialog.cpp kopeteview.cpp \ kopetepasswordwidgetbase.ui kopetepasswordwidget.cpp accountselector.cpp kopeteviewplugin.cpp \ - addresseeitem.cpp addressbootdeselectorwidget_base.ui addressbootdeselectordialog.cpp \ - addressbootdeselectorwidget.cpp metacontactselectorwidget_base.ui metacontactselectorwidget.cpp \ + addresseeitem.cpp addressbookselectorwidget_base.ui addressbookselectordialog.cpp \ + addressbookselectorwidget.cpp metacontactselectorwidget_base.ui metacontactselectorwidget.cpp \ kopetelistview.cpp kopetelistviewitem.cpp kopetelistviewsearchline.cpp \ contactaddednotifywidget.ui contactaddednotifydialog.cpp addressbooklinkwidget_base.ui \ addressbooklinkwidget.cpp @@ -22,7 +22,7 @@ kopeteinclude_HEADERS = accountselector.h fileconfirmbase.h \ kopetefileconfirmdialog.h kopetepasswordwidget.h kopeteview.h addcontactpage.h \ kopeteawaydialogbase.h kopetepasswordwidgetbase.h kopeteviewplugin.h editaccountwidget.h \ kopetecontactaction.h kopetepassworddialog.h kopetestdaction.h userinfodialog.h \ - addressbootdeselectordialog.h addressbootdeselectorwidget.h kopetelistview.h kopetelistviewitem.h \ + addressbookselectordialog.h addressbookselectorwidget.h kopetelistview.h kopetelistviewitem.h \ kopetelistviewsearchline.h addressbooklinkwidget.h noinst_HEADERS = addresseeitem.h contactaddednotifywidget.h diff --git a/kopete/libkopete/ui/addressbooklinkwidget.cpp b/kopete/libkopete/ui/addressbooklinkwidget.cpp index 877cfb4e..31e04a52 100644 --- a/kopete/libkopete/ui/addressbooklinkwidget.cpp +++ b/kopete/libkopete/ui/addressbooklinkwidget.cpp @@ -31,8 +31,8 @@ #include #include "addressbooklinkwidget.h" -#include "addressbootdeselectordialog.h" -#include "addressbootdeselectorwidget.h" +#include "addressbookselectordialog.h" +#include "addressbookselectorwidget.h" namespace Kopete { namespace UI { diff --git a/kopete/libkopete/ui/addressbookselectordialog.cpp b/kopete/libkopete/ui/addressbookselectordialog.cpp new file mode 100644 index 00000000..44f42e2a --- /dev/null +++ b/kopete/libkopete/ui/addressbookselectordialog.cpp @@ -0,0 +1,89 @@ +/* + AddressBookSelectorDialog + Nice Dialog to select a KDE AddressBook contact + + Copyright (c) 2005 by Duncan Mac-Vicar Prett + + Kopete (c) 2002-2005 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + +#include "addressbookselectordialog.h" +#include "addressbookselectorwidget.h" +#include +#include +#include +#include +#include +#include + +namespace Kopete +{ +namespace UI +{ + +AddressBookSelectorDialog::AddressBookSelectorDialog(const TQString &title, const TQString &message, const TQString &preSelectUid, TQWidget *parent, const char *name, bool modal ) : KDialogBase(parent, name, modal, title, Help|Ok|Cancel, Ok, true ) +{ + TQVBox *vbox=new TQVBox(this); + m_addressBookSelectorWidget= new AddressBookSelectorWidget(vbox); + m_addressBookSelectorWidget->setLabelMessage(message); + + vbox->setSpacing( KDialog::spacingHint() ); + + setMainWidget(vbox); + enableButtonOK(false); + //setHelp("linkaddressbook"); + + connect(m_addressBookSelectorWidget, TQT_SIGNAL(addresseeListClicked( TQListViewItem * )), TQT_SLOT(slotWidgetAddresseeListClicked( TQListViewItem * ))); + + if ( !preSelectUid.isEmpty() ) + m_addressBookSelectorWidget->selectAddressee(preSelectUid); +} + +AddressBookSelectorDialog::~AddressBookSelectorDialog() +{ +} + +KABC::Addressee AddressBookSelectorDialog::getAddressee( const TQString &title, const TQString &message, const TQString &preSelectUid, TQWidget *parent) +{ + AddressBookSelectorDialog dialog(title, message, preSelectUid, parent); + int result = dialog.exec(); + + KABC::Addressee adr; + if ( result == TQDialog::Accepted ) + adr = dialog.addressBookSelectorWidget()->addressee(); + + return adr; +} + +void AddressBookSelectorDialog::slotWidgetAddresseeListClicked( TQListViewItem *addressee ) +{ + // enable ok if a valid addressee is selected + enableButtonOK( addressee ? addressee->isSelected() : false); +} + +void AddressBookSelectorDialog::accept() +{ + TQDialog::accept(); +} + +void AddressBookSelectorDialog::reject() +{ + TQDialog::reject(); +} + +} // namespace UI +} // namespace Kopete + +#include "addressbookselectordialog.moc" + +// vim: set noet ts=4 sts=4 sw=4: + diff --git a/kopete/libkopete/ui/addressbookselectordialog.h b/kopete/libkopete/ui/addressbookselectordialog.h new file mode 100644 index 00000000..5f5f6500 --- /dev/null +++ b/kopete/libkopete/ui/addressbookselectordialog.h @@ -0,0 +1,91 @@ +/* + AddressBookSelectorDialog + Nice Dialog to select a KDE AddressBook contact + + Copyright (c) 2005 by Duncan Mac-Vicar Prett + + Kopete (c) 2002-2005 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + +#ifndef ADDRESSBOOKSELECTORDIALOG_H +#define ADDRESSBOOKSELECTORDIALOG_H + +#include +#include "kopete_export.h" +#include + +namespace KABC +{ + class AddressBook; + class Addressee; +} + +namespace Kopete +{ +namespace UI +{ + +class AddressBookSelectorWidget; + +/** + * A dialog that uses AddressBookSelectorWidget to allow the user + * to select a KDE addressbook contact. If you want to use special features + * you can use @see addressBookSelectorWidget() to get the pointer to the + * AddressBookSelectorWidget object and set the desired options there. + * + * @author Duncan Mac-Vicar Prett + */ +class KOPETE_EXPORT AddressBookSelectorDialog : public KDialogBase +{ + Q_OBJECT + +public: + /** + * The constructor of an empty AddressBookSelectorWidget + */ + AddressBookSelectorDialog( const TQString &title, const TQString &message, const TQString &preSelectUid, TQWidget *parent=0L, const char *name=0L, bool modal = false ); + /** + * The destructor of the dialog + */ + ~AddressBookSelectorDialog(); + + /** + * @returns the AddressBookSelectorWidget widget so that additional + * parameters can be set by using it. + */ + AddressBookSelectorWidget *addressBookSelectorWidget() const + { return m_addressBookSelectorWidget; }; + + /** + * Creates a modal dialog, lets the user to select a addressbook contact + * and returns when the dialog is closed. + * + * @returns the selected contact, or a null addressee if the user + * pressed the Cancel button. Optionally + */ + static KABC::Addressee getAddressee( const TQString &title, const TQString &message, const TQString &preSelectUid, TQWidget *parent = 0L ); + +protected slots: + virtual void accept(); + virtual void reject(); + void slotWidgetAddresseeListClicked( TQListViewItem *addressee ); +protected: + AddressBookSelectorWidget *m_addressBookSelectorWidget; +}; + +} // namespace UI +} // namespace Kopete + +#endif + +// vim: set noet ts=4 sts=4 sw=4: + diff --git a/kopete/libkopete/ui/addressbookselectorwidget.cpp b/kopete/libkopete/ui/addressbookselectorwidget.cpp new file mode 100644 index 00000000..6ae61bff --- /dev/null +++ b/kopete/libkopete/ui/addressbookselectorwidget.cpp @@ -0,0 +1,171 @@ +/* + AddressBookSelectorWidget + + Copyright (c) 2005 by Duncan Mac-Vicar Prett + + Based on LinkAddressBookUI whose code was shamelessly stolen from + kopete's add new contact wizard, used in Konversation, and then + reappropriated by Kopete. + + LinkAddressBookUI: + Copyright (c) 2004 by John Tapsell + Copyright (c) 2003-2005 by Will Stephenson + Copyright (c) 2002 by Nick Betcher + Copyright (c) 2002 by Duncan Mac-Vicar Prett + + Kopete (c) 2002-2004 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "addressbookselectorwidget.h" +#include +#include "kabcpersistence.h" + +using namespace Kopete::UI; + +namespace Kopete +{ +namespace UI +{ + +AddressBookSelectorWidget::AddressBookSelectorWidget( TQWidget *parent, const char *name ) + : AddressBookSelectorWidget_Base( parent, name ) +{ + m_addressBook = Kopete::KABCPersistence::self()->addressBook(); + + // Addressee validation connections + connect( addAddresseeButton, TQT_SIGNAL( clicked() ), TQT_SLOT( slotAddAddresseeClicked() ) ); + connect( addAddresseeButton, TQT_SIGNAL( clicked() ), TQT_SIGNAL( addAddresseeClicked() ) ); + + connect( addresseeListView, TQT_SIGNAL( clicked(TQListViewItem * ) ), + TQT_SIGNAL( addresseeListClicked( TQListViewItem * ) ) ); + connect( addresseeListView, TQT_SIGNAL( selectionChanged( TQListViewItem * ) ), + TQT_SIGNAL( addresseeListClicked( TQListViewItem * ) ) ); + connect( addresseeListView, TQT_SIGNAL( spacePressed( TQListViewItem * ) ), + TQT_SIGNAL( addresseeListClicked( TQListViewItem * ) ) ); + + connect( m_addressBook, TQT_SIGNAL( addressBookChanged( AddressBook * ) ), this, TQT_SLOT( slotLoadAddressees() ) ); + + //We should add a clear TDEAction here. But we can't really do that with a designer file :\ this sucks + + addresseeListView->setColumnText(2, SmallIconSet(TQString::fromLatin1("email")), i18n("Email")); + + kListViewSearchLine->setListView(addresseeListView); + slotLoadAddressees(); + + addresseeListView->setColumnWidthMode(0, TQListView::Manual); + addresseeListView->setColumnWidth(0, 63); //Photo is 60, and it's nice to have a small gap, imho +} + + +AddressBookSelectorWidget::~AddressBookSelectorWidget() +{ + disconnect( m_addressBook, TQT_SIGNAL( addressBookChanged( AddressBook * ) ), this, TQT_SLOT( slotLoadAddressees() ) ); +} + + +KABC::Addressee AddressBookSelectorWidget::addressee() +{ + AddresseeItem *item = 0L; + item = static_cast( addresseeListView->selectedItem() ); + + if ( item ) + m_addressee = item->addressee(); + + return m_addressee; +} + +void AddressBookSelectorWidget::selectAddressee( const TQString &uid ) +{ + // iterate trough list view + TQListViewItemIterator it( addresseeListView ); + while( it.current() ) + { + AddresseeItem *addrItem = (AddresseeItem *) it.current(); + if ( addrItem->addressee().uid() == uid ) + { + // select the contact item + addresseeListView->setSelected( addrItem, true ); + addresseeListView->ensureItemVisible( addrItem ); + } + ++it; + } +} + +bool AddressBookSelectorWidget::addresseeSelected() +{ + return addresseeListView->selectedItem() ? true : false; +} + +/** Read in contacts from addressbook, and select the contact that is for our nick. */ +void AddressBookSelectorWidget::slotLoadAddressees() +{ + addresseeListView->clear(); + KABC::AddressBook::Iterator it; + AddresseeItem *addr; + for( it = m_addressBook->begin(); it != m_addressBook->end(); ++it ) + { + addr = new AddresseeItem( addresseeListView, (*it)); + } + +} + +void AddressBookSelectorWidget::setLabelMessage( const TQString &msg ) +{ + lblHeader->setText(msg); +} + +void AddressBookSelectorWidget::slotAddAddresseeClicked() +{ + // Pop up add addressee dialog + TQString addresseeName = KInputDialog::getText( i18n( "New Address Book Entry" ), i18n( "Name the new entry:" ), TQString(), 0, this ); + + if ( !addresseeName.isEmpty() ) + { + KABC::Addressee addr; + addr.setNameFromString( addresseeName ); + m_addressBook->insertAddressee(addr); + Kopete::KABCPersistence::self()->writeAddressBook( 0 ); + slotLoadAddressees(); + // select the addressee we just added + TQListViewItem * added = addresseeListView->findItem( addresseeName, 1 ); + kListViewSearchLine->clear(); + kListViewSearchLine->updateSearch(); + addresseeListView->setSelected( added, true ); + addresseeListView->ensureItemVisible( added ); + } +} + +} // namespace UI +} // namespace Kopete + +#include "addressbookselectorwidget.moc" + +// vim: set noet ts=4 sts=4 sw=4: + diff --git a/kopete/libkopete/ui/addressbookselectorwidget.h b/kopete/libkopete/ui/addressbookselectorwidget.h new file mode 100644 index 00000000..af4b1834 --- /dev/null +++ b/kopete/libkopete/ui/addressbookselectorwidget.h @@ -0,0 +1,91 @@ +/* + AddressBookSelectorWidget + Copyright (c) 2005 by Duncan Mac-Vicar Prett + + Based on LinkAddressBookUI whose code was shamelessly stolen from + kopete's add new contact wizard, used in Konversation, and then + reappropriated by Kopete. + + LinkAddressBookUI: + Copyright (c) 2004 by John Tapsell + Copyright (c) 2003-2005 by Will Stephenson + Copyright (c) 2002 by Nick Betcher + Copyright (c) 2002 by Duncan Mac-Vicar Prett + + Kopete (c) 2002-2004 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + +#ifndef AddressBookSelectorWidget_H +#define AddressBookSelectorWidget_H + +#include +#include + +#include +#include "kopete_export.h" + +#include "addressbookselectorwidget_base.h" + +namespace KABC { + class AddressBook; + class Addressee; +} + +namespace Kopete +{ +namespace UI +{ + +class KOPETE_EXPORT AddressBookSelectorWidget : public AddressBookSelectorWidget_Base +{ + Q_OBJECT + +public: + AddressBookSelectorWidget( TQWidget *parent = 0, const char *name = 0 ); + ~AddressBookSelectorWidget(); + KABC::Addressee addressee(); + /** + * sets the widget label message + * example: Please select a contact + * or, Choose a contact to delete + */ + void setLabelMessage( const TQString &msg ); + /** + * pre-selects a contact + */ + void selectAddressee( const TQString &uid ); + /** + * @return true if there is a contact selected + */ + bool addresseeSelected(); + +private: + KABC::AddressBook * m_addressBook; + KABC::Addressee m_addressee; + +protected slots: + void slotAddAddresseeClicked(); + /** + * Utility function, populates the addressee list + */ + void slotLoadAddressees(); +signals: + void addresseeListClicked( TQListViewItem *addressee ); + void addAddresseeClicked(); +}; + +} // namespace UI +} // namespace Kopete + +#endif + +// vim: set noet ts=4 sts=4 sw=4: diff --git a/kopete/libkopete/ui/addressbookselectorwidget_base.ui b/kopete/libkopete/ui/addressbookselectorwidget_base.ui new file mode 100644 index 00000000..fd046bf8 --- /dev/null +++ b/kopete/libkopete/ui/addressbookselectorwidget_base.ui @@ -0,0 +1,175 @@ + +AddressBookSelectorWidget_Base + + + AddressBookSelectorWidget_Base + + + + 0 + 0 + 596 + 572 + + + + + 5 + 1 + 0 + 0 + + + + Select Contact + + + + unnamed + + + 0 + + + + spacer11 + + + Horizontal + + + Expanding + + + + 405 + 20 + + + + + + addAddresseeButton + + + Create New Entr&y... + + + Create a new entry in your address book + + + + + lblHeader + + + + 7 + 4 + 0 + 0 + + + + + + + Photo + + + false + + + true + + + + + Name + + + true + + + true + + + + + Email + + + true + + + true + + + + addresseeListView + + + + 7 + 7 + 0 + 10 + + + + true + + + LastColumn + + + Select the contact you want to communicate with via Instant Messaging + + + + + layout1 + + + + unnamed + + + + lblSearch + + + + 1 + 5 + 0 + 0 + + + + S&earch: + + + kListViewSearchLine + + + + + kListViewSearchLine + + + + + + + + tdelistviewsearchline.h + + + + + kactivelabel.h + tdelistview.h + tdelistviewsearchline.h + + diff --git a/kopete/libkopete/ui/addressbootdeselectordialog.cpp b/kopete/libkopete/ui/addressbootdeselectordialog.cpp deleted file mode 100644 index 27560ef1..00000000 --- a/kopete/libkopete/ui/addressbootdeselectordialog.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - AddressBookSelectorDialog - Nice Dialog to select a KDE AddressBook contact - - Copyright (c) 2005 by Duncan Mac-Vicar Prett - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ************************************************************************* -*/ - -#include "addressbootdeselectordialog.h" -#include "addressbootdeselectorwidget.h" -#include -#include -#include -#include -#include -#include - -namespace Kopete -{ -namespace UI -{ - -AddressBookSelectorDialog::AddressBookSelectorDialog(const TQString &title, const TQString &message, const TQString &preSelectUid, TQWidget *parent, const char *name, bool modal ) : KDialogBase(parent, name, modal, title, Help|Ok|Cancel, Ok, true ) -{ - TQVBox *vbox=new TQVBox(this); - m_addressBookSelectorWidget= new AddressBookSelectorWidget(vbox); - m_addressBookSelectorWidget->setLabelMessage(message); - - vbox->setSpacing( KDialog::spacingHint() ); - - setMainWidget(vbox); - enableButtonOK(false); - //setHelp("linkaddressbook"); - - connect(m_addressBookSelectorWidget, TQT_SIGNAL(addresseeListClicked( TQListViewItem * )), TQT_SLOT(slotWidgetAddresseeListClicked( TQListViewItem * ))); - - if ( !preSelectUid.isEmpty() ) - m_addressBookSelectorWidget->selectAddressee(preSelectUid); -} - -AddressBookSelectorDialog::~AddressBookSelectorDialog() -{ -} - -KABC::Addressee AddressBookSelectorDialog::getAddressee( const TQString &title, const TQString &message, const TQString &preSelectUid, TQWidget *parent) -{ - AddressBookSelectorDialog dialog(title, message, preSelectUid, parent); - int result = dialog.exec(); - - KABC::Addressee adr; - if ( result == TQDialog::Accepted ) - adr = dialog.addressBookSelectorWidget()->addressee(); - - return adr; -} - -void AddressBookSelectorDialog::slotWidgetAddresseeListClicked( TQListViewItem *addressee ) -{ - // enable ok if a valid addressee is selected - enableButtonOK( addressee ? addressee->isSelected() : false); -} - -void AddressBookSelectorDialog::accept() -{ - TQDialog::accept(); -} - -void AddressBookSelectorDialog::reject() -{ - TQDialog::reject(); -} - -} // namespace UI -} // namespace Kopete - -#include "addressbootdeselectordialog.moc" - -// vim: set noet ts=4 sts=4 sw=4: - diff --git a/kopete/libkopete/ui/addressbootdeselectordialog.h b/kopete/libkopete/ui/addressbootdeselectordialog.h deleted file mode 100644 index 5f5f6500..00000000 --- a/kopete/libkopete/ui/addressbootdeselectordialog.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - AddressBookSelectorDialog - Nice Dialog to select a KDE AddressBook contact - - Copyright (c) 2005 by Duncan Mac-Vicar Prett - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ************************************************************************* -*/ - -#ifndef ADDRESSBOOKSELECTORDIALOG_H -#define ADDRESSBOOKSELECTORDIALOG_H - -#include -#include "kopete_export.h" -#include - -namespace KABC -{ - class AddressBook; - class Addressee; -} - -namespace Kopete -{ -namespace UI -{ - -class AddressBookSelectorWidget; - -/** - * A dialog that uses AddressBookSelectorWidget to allow the user - * to select a KDE addressbook contact. If you want to use special features - * you can use @see addressBookSelectorWidget() to get the pointer to the - * AddressBookSelectorWidget object and set the desired options there. - * - * @author Duncan Mac-Vicar Prett - */ -class KOPETE_EXPORT AddressBookSelectorDialog : public KDialogBase -{ - Q_OBJECT - -public: - /** - * The constructor of an empty AddressBookSelectorWidget - */ - AddressBookSelectorDialog( const TQString &title, const TQString &message, const TQString &preSelectUid, TQWidget *parent=0L, const char *name=0L, bool modal = false ); - /** - * The destructor of the dialog - */ - ~AddressBookSelectorDialog(); - - /** - * @returns the AddressBookSelectorWidget widget so that additional - * parameters can be set by using it. - */ - AddressBookSelectorWidget *addressBookSelectorWidget() const - { return m_addressBookSelectorWidget; }; - - /** - * Creates a modal dialog, lets the user to select a addressbook contact - * and returns when the dialog is closed. - * - * @returns the selected contact, or a null addressee if the user - * pressed the Cancel button. Optionally - */ - static KABC::Addressee getAddressee( const TQString &title, const TQString &message, const TQString &preSelectUid, TQWidget *parent = 0L ); - -protected slots: - virtual void accept(); - virtual void reject(); - void slotWidgetAddresseeListClicked( TQListViewItem *addressee ); -protected: - AddressBookSelectorWidget *m_addressBookSelectorWidget; -}; - -} // namespace UI -} // namespace Kopete - -#endif - -// vim: set noet ts=4 sts=4 sw=4: - diff --git a/kopete/libkopete/ui/addressbootdeselectorwidget.cpp b/kopete/libkopete/ui/addressbootdeselectorwidget.cpp deleted file mode 100644 index d218fe1c..00000000 --- a/kopete/libkopete/ui/addressbootdeselectorwidget.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - AddressBookSelectorWidget - - Copyright (c) 2005 by Duncan Mac-Vicar Prett - - Based on LinkAddressBookUI whose code was shamelessly stolen from - kopete's add new contact wizard, used in Konversation, and then - reappropriated by Kopete. - - LinkAddressBookUI: - Copyright (c) 2004 by John Tapsell - Copyright (c) 2003-2005 by Will Stephenson - Copyright (c) 2002 by Nick Betcher - Copyright (c) 2002 by Duncan Mac-Vicar Prett - - Kopete (c) 2002-2004 by the Kopete developers - - ************************************************************************* - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ************************************************************************* -*/ - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "addressbootdeselectorwidget.h" -#include -#include "kabcpersistence.h" - -using namespace Kopete::UI; - -namespace Kopete -{ -namespace UI -{ - -AddressBookSelectorWidget::AddressBookSelectorWidget( TQWidget *parent, const char *name ) - : AddressBookSelectorWidget_Base( parent, name ) -{ - m_addressBook = Kopete::KABCPersistence::self()->addressBook(); - - // Addressee validation connections - connect( addAddresseeButton, TQT_SIGNAL( clicked() ), TQT_SLOT( slotAddAddresseeClicked() ) ); - connect( addAddresseeButton, TQT_SIGNAL( clicked() ), TQT_SIGNAL( addAddresseeClicked() ) ); - - connect( addresseeListView, TQT_SIGNAL( clicked(TQListViewItem * ) ), - TQT_SIGNAL( addresseeListClicked( TQListViewItem * ) ) ); - connect( addresseeListView, TQT_SIGNAL( selectionChanged( TQListViewItem * ) ), - TQT_SIGNAL( addresseeListClicked( TQListViewItem * ) ) ); - connect( addresseeListView, TQT_SIGNAL( spacePressed( TQListViewItem * ) ), - TQT_SIGNAL( addresseeListClicked( TQListViewItem * ) ) ); - - connect( m_addressBook, TQT_SIGNAL( addressBookChanged( AddressBook * ) ), this, TQT_SLOT( slotLoadAddressees() ) ); - - //We should add a clear TDEAction here. But we can't really do that with a designer file :\ this sucks - - addresseeListView->setColumnText(2, SmallIconSet(TQString::fromLatin1("email")), i18n("Email")); - - kListViewSearchLine->setListView(addresseeListView); - slotLoadAddressees(); - - addresseeListView->setColumnWidthMode(0, TQListView::Manual); - addresseeListView->setColumnWidth(0, 63); //Photo is 60, and it's nice to have a small gap, imho -} - - -AddressBookSelectorWidget::~AddressBookSelectorWidget() -{ - disconnect( m_addressBook, TQT_SIGNAL( addressBookChanged( AddressBook * ) ), this, TQT_SLOT( slotLoadAddressees() ) ); -} - - -KABC::Addressee AddressBookSelectorWidget::addressee() -{ - AddresseeItem *item = 0L; - item = static_cast( addresseeListView->selectedItem() ); - - if ( item ) - m_addressee = item->addressee(); - - return m_addressee; -} - -void AddressBookSelectorWidget::selectAddressee( const TQString &uid ) -{ - // iterate trough list view - TQListViewItemIterator it( addresseeListView ); - while( it.current() ) - { - AddresseeItem *addrItem = (AddresseeItem *) it.current(); - if ( addrItem->addressee().uid() == uid ) - { - // select the contact item - addresseeListView->setSelected( addrItem, true ); - addresseeListView->ensureItemVisible( addrItem ); - } - ++it; - } -} - -bool AddressBookSelectorWidget::addresseeSelected() -{ - return addresseeListView->selectedItem() ? true : false; -} - -/** Read in contacts from addressbook, and select the contact that is for our nick. */ -void AddressBookSelectorWidget::slotLoadAddressees() -{ - addresseeListView->clear(); - KABC::AddressBook::Iterator it; - AddresseeItem *addr; - for( it = m_addressBook->begin(); it != m_addressBook->end(); ++it ) - { - addr = new AddresseeItem( addresseeListView, (*it)); - } - -} - -void AddressBookSelectorWidget::setLabelMessage( const TQString &msg ) -{ - lblHeader->setText(msg); -} - -void AddressBookSelectorWidget::slotAddAddresseeClicked() -{ - // Pop up add addressee dialog - TQString addresseeName = KInputDialog::getText( i18n( "New Address Book Entry" ), i18n( "Name the new entry:" ), TQString(), 0, this ); - - if ( !addresseeName.isEmpty() ) - { - KABC::Addressee addr; - addr.setNameFromString( addresseeName ); - m_addressBook->insertAddressee(addr); - Kopete::KABCPersistence::self()->writeAddressBook( 0 ); - slotLoadAddressees(); - // select the addressee we just added - TQListViewItem * added = addresseeListView->findItem( addresseeName, 1 ); - kListViewSearchLine->clear(); - kListViewSearchLine->updateSearch(); - addresseeListView->setSelected( added, true ); - addresseeListView->ensureItemVisible( added ); - } -} - -} // namespace UI -} // namespace Kopete - -#include "addressbootdeselectorwidget.moc" - -// vim: set noet ts=4 sts=4 sw=4: - diff --git a/kopete/libkopete/ui/addressbootdeselectorwidget.h b/kopete/libkopete/ui/addressbootdeselectorwidget.h deleted file mode 100644 index 2a549e1c..00000000 --- a/kopete/libkopete/ui/addressbootdeselectorwidget.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - AddressBookSelectorWidget - Copyright (c) 2005 by Duncan Mac-Vicar Prett - - Based on LinkAddressBookUI whose code was shamelessly stolen from - kopete's add new contact wizard, used in Konversation, and then - reappropriated by Kopete. - - LinkAddressBookUI: - Copyright (c) 2004 by John Tapsell - Copyright (c) 2003-2005 by Will Stephenson - Copyright (c) 2002 by Nick Betcher - Copyright (c) 2002 by Duncan Mac-Vicar Prett - - Kopete (c) 2002-2004 by the Kopete developers - - ************************************************************************* - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ************************************************************************* -*/ - -#ifndef AddressBookSelectorWidget_H -#define AddressBookSelectorWidget_H - -#include -#include - -#include -#include "kopete_export.h" - -#include "addressbootdeselectorwidget_base.h" - -namespace KABC { - class AddressBook; - class Addressee; -} - -namespace Kopete -{ -namespace UI -{ - -class KOPETE_EXPORT AddressBookSelectorWidget : public AddressBookSelectorWidget_Base -{ - Q_OBJECT - -public: - AddressBookSelectorWidget( TQWidget *parent = 0, const char *name = 0 ); - ~AddressBookSelectorWidget(); - KABC::Addressee addressee(); - /** - * sets the widget label message - * example: Please select a contact - * or, Choose a contact to delete - */ - void setLabelMessage( const TQString &msg ); - /** - * pre-selects a contact - */ - void selectAddressee( const TQString &uid ); - /** - * @return true if there is a contact selected - */ - bool addresseeSelected(); - -private: - KABC::AddressBook * m_addressBook; - KABC::Addressee m_addressee; - -protected slots: - void slotAddAddresseeClicked(); - /** - * Utility function, populates the addressee list - */ - void slotLoadAddressees(); -signals: - void addresseeListClicked( TQListViewItem *addressee ); - void addAddresseeClicked(); -}; - -} // namespace UI -} // namespace Kopete - -#endif - -// vim: set noet ts=4 sts=4 sw=4: diff --git a/kopete/libkopete/ui/addressbootdeselectorwidget_base.ui b/kopete/libkopete/ui/addressbootdeselectorwidget_base.ui deleted file mode 100644 index fd046bf8..00000000 --- a/kopete/libkopete/ui/addressbootdeselectorwidget_base.ui +++ /dev/null @@ -1,175 +0,0 @@ - -AddressBookSelectorWidget_Base - - - AddressBookSelectorWidget_Base - - - - 0 - 0 - 596 - 572 - - - - - 5 - 1 - 0 - 0 - - - - Select Contact - - - - unnamed - - - 0 - - - - spacer11 - - - Horizontal - - - Expanding - - - - 405 - 20 - - - - - - addAddresseeButton - - - Create New Entr&y... - - - Create a new entry in your address book - - - - - lblHeader - - - - 7 - 4 - 0 - 0 - - - - - - - Photo - - - false - - - true - - - - - Name - - - true - - - true - - - - - Email - - - true - - - true - - - - addresseeListView - - - - 7 - 7 - 0 - 10 - - - - true - - - LastColumn - - - Select the contact you want to communicate with via Instant Messaging - - - - - layout1 - - - - unnamed - - - - lblSearch - - - - 1 - 5 - 0 - 0 - - - - S&earch: - - - kListViewSearchLine - - - - - kListViewSearchLine - - - - - - - - tdelistviewsearchline.h - - - - - kactivelabel.h - tdelistview.h - tdelistviewsearchline.h - - diff --git a/kopete/libkopete/ui/contactaddednotifydialog.cpp b/kopete/libkopete/ui/contactaddednotifydialog.cpp index 7a230e2c..5b5e1e55 100644 --- a/kopete/libkopete/ui/contactaddednotifydialog.cpp +++ b/kopete/libkopete/ui/contactaddednotifydialog.cpp @@ -38,7 +38,7 @@ #include "kopetecontactlist.h" #include "kopetemetacontact.h" #include "addressbooklinkwidget.h" -#include "addressbootdeselectordialog.h" +#include "addressbookselectordialog.h" #include "contactaddednotifywidget.h" -- cgit v1.2.3