author | zautrix <zautrix> | 2005-10-28 13:24:38 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-28 13:24:38 (UTC) |
commit | 61a52cfdb0eda075dabde46984cf05b37856bbc2 (patch) (side-by-side diff) | |
tree | cd587a374d62fa9b50143305f762c0ed995bd50c | |
parent | cee83f70d8e4a6945f4456c55ab1b280d3425f0f (diff) | |
download | kdepimpi-61a52cfdb0eda075dabde46984cf05b37856bbc2.zip kdepimpi-61a52cfdb0eda075dabde46984cf05b37856bbc2.tar.gz kdepimpi-61a52cfdb0eda075dabde46984cf05b37856bbc2.tar.bz2 |
commit
-rw-r--r-- | desktop/rpm/kdepim_rpm | 2 | ||||
-rw-r--r-- | kaddressbook/addresseeeditorwidget.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/phoneeditwidget.cpp | 80 | ||||
-rw-r--r-- | kaddressbook/phoneeditwidget.h | 19 | ||||
-rw-r--r-- | version | 2 |
5 files changed, 74 insertions, 31 deletions
diff --git a/desktop/rpm/kdepim_rpm b/desktop/rpm/kdepim_rpm index 2b5b390..9076943 100644 --- a/desktop/rpm/kdepim_rpm +++ b/desktop/rpm/kdepim_rpm @@ -1,11 +1,11 @@ Summary: A collection of PIM programs Name: KDE-Pim-Pi -Version: 2.2.5 +Version: 2.2.6 Release: SuSE_9.2 Copyright:GPL Group: Productivity/Pim Source:http://sourceforge.net/projects/kdepimpi/ URL:http://sourceforge.net/projects/kdepimpi/ Packager: zautrix %description diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp index 9814cd5..966efa5 100644 --- a/kaddressbook/addresseeeditorwidget.cpp +++ b/kaddressbook/addresseeeditorwidget.cpp @@ -1183,17 +1183,17 @@ void AddresseeEditorWidget::save() for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); ++phoneIter ) mAddressee.removePhoneNumber( *phoneIter ); phoneNumbers = mPhoneEditWidget->phoneNumbers(); for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); ++phoneIter ) mAddressee.insertPhoneNumber( *phoneIter ); - + mAddressee.makePhoneNumbersOLcompatible(); // Save the addresses KABC::Address::List addresses; KABC::Address::List::Iterator addressIter; addresses = mAddressee.addresses(); for ( addressIter = addresses.begin(); addressIter != addresses.end(); ++addressIter ) mAddressee.removeAddress( *addressIter ); diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp index 997fc05..9e7e221 100644 --- a/kaddressbook/phoneeditwidget.cpp +++ b/kaddressbook/phoneeditwidget.cpp @@ -26,16 +26,17 @@ #include <qtooltip.h> #include <qpushbutton.h> #include <qcheckbox.h> #include <qstring.h> #include <qlistbox.h> #include <qlistview.h> #include <qbuttongroup.h> #include <qhbox.h> +#include <qcursor.h> #include <kbuttonbox.h> #include <klistview.h> #include <kapplication.h> #include <qapplication.h> #include <kconfig.h> #include <klineedit.h> #include <kcombobox.h> @@ -46,42 +47,53 @@ #include <kabc/phonenumber.h> #include "typecombo.h" #include "phoneeditwidget.h" PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) - : QScrollView(parent,name) -{ - setFrameStyle ( QFrame::Panel | QFrame::Plain ); - setLineWidth ( 1 ); - setMidLineWidth ( 1 ); - mw = new QWidget ( viewport() ); - addChild(mw); - setResizePolicy( AutoOneFit ); - mainLayout = new QVBoxLayout ( mw ); - mainLayout->setMargin( 2 ); - mainLayout->setSpacing( 2 ); - QWidget* hb = new QWidget ( mw ); - mainLayout->add( hb ); - QHBoxLayout* hbLayout = new QHBoxLayout ( hb ); - QPushButton *addBut = new QPushButton ( "add", hb ); - hbLayout->add( addBut ); + : QWidget(parent,name) +{ + QGridLayout* gridLayout = new QGridLayout ( this, 2,2 ); + + QLabel *temp = new QLabel( "", this ); + temp->setAlignment( Qt::AlignCenter ); + temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); + gridLayout->addWidget( temp, 1, 0 ); + QPushButton *addBut = new QPushButton ( "add", this ); addBut->setPixmap ( SmallIcon("plus")); addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() ); connect(addBut,SIGNAL(clicked()),SLOT(addNumber())); - //QLabel * temp = new QLabel( i18n("Phone Type"), hb ); - QLabel *temp = new QLabel( i18n("Phone Number"),hb ); - temp->setAlignment( Qt::AlignCenter ); - temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); - hbLayout->add( temp ); + gridLayout->addWidget( addBut, 0, 0 ); + + sv = new QScrollView( this ); + sv->setFrameStyle ( QFrame::Panel | QFrame::Plain ); + sv->setLineWidth ( 1 ); + sv->setMidLineWidth ( 1 ); + mw = new QWidget ( sv->viewport() ); + sv->addChild(mw); + sv->setResizePolicy( QScrollView::AutoOneFit ); + mainLayout = new QVBoxLayout ( mw ); + mainLayout->setMargin( 2 ); + mainLayout->setSpacing( 2 ); + gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 ); setDefaults(); mTypeNumberEditList.setAutoDelete( true ); + mPopup = new QPopupMenu( this ); + QStringList list = PhoneNumber::supportedTypeListNames(); + mPopupCount = list.count(); + int i = 0; + while ( i < mPopupCount ) { + mPopup->insertItem( list[ i ], i ); + ++i; + } + connect(mPopup,SIGNAL(activated(int)),this,SLOT(addNumberInt( int))); + } PhoneEditWidget::~PhoneEditWidget() { } void PhoneEditWidget::setDefaults() { mTypeNumberEditList.clear(); @@ -92,19 +104,43 @@ void PhoneEditWidget::setDefaults() edit = appendEditCombo(); phoneNumber.setType( KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref ); edit->setPhoneNumber( phoneNumber ); edit = appendEditCombo(); phoneNumber.setType( KABC::PhoneNumber::Cell ); edit->setPhoneNumber( phoneNumber ); } +void PhoneEditWidget::addNumberInt( int index ) +{ + PhoneTypeNumberEdit* edit = appendEditCombo(); + KABC::PhoneNumber phoneNumber; + phoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); + edit->setPhoneNumber( phoneNumber ); + //verticalScrollBar()->setValue( 1024); + QTimer::singleShot( 0, this, SLOT ( bottomVisible() ) ); +} +void PhoneEditWidget::bottomVisible() +{ + sv->setContentsPos ( 0, 1024 ); +} void PhoneEditWidget::addNumber() { - + int i = 0; + while ( i < mPopupCount ) { + mPopup->setItemEnabled( i, true ); + ++i; + } + PhoneTypeNumberEdit* edit = mTypeNumberEditList.first(); + while ( edit ) { + if ( edit->currentType() < mPopupCount -1 ) + mPopup->setItemEnabled( edit->currentType(), false ); + edit = mTypeNumberEditList.next(); + } + mPopup->popup( QCursor::pos() ); } PhoneTypeNumberEdit* PhoneEditWidget::appendEditCombo() { PhoneTypeNumberEdit* edit = new PhoneTypeNumberEdit( mw ); connect ( edit, SIGNAL ( typeChange( int , int) ), this, SIGNAL ( typeChange( int , int)) ); connect ( edit, SIGNAL ( modified() ), this, SIGNAL ( modified() ) ); connect ( edit, SIGNAL ( deleteMe( PhoneTypeNumberEdit* ) ), this, SLOT ( deleteEdit( PhoneTypeNumberEdit*) ) ); connect ( this, SIGNAL ( typeChange( int , int)), edit, SLOT ( typeExternalChanged( int, int)) ); diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h index c730c7b..df5aff9 100644 --- a/kaddressbook/phoneeditwidget.h +++ b/kaddressbook/phoneeditwidget.h @@ -22,16 +22,17 @@ with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <kdialogbase.h> #include <kiconloader.h> #include <qpushbutton.h> #include <qlayout.h> +#include <qpopupmenu.h> #include <qptrlist.h> #include <qscrollview.h> #include "addresseeconfig.h" #include "typecombo.h" class QButtonGroup; @@ -42,17 +43,17 @@ class PhoneTypeNumberEdit; #include <kcombobox.h> #include <kabc/phonenumber.h> typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo; /** Widget for editing phone numbers. */ -class PhoneEditWidget : public QScrollView +class PhoneEditWidget : public QWidget { Q_OBJECT public: PhoneEditWidget( QWidget *parent, const char *name = 0 ); ~PhoneEditWidget(); void setPhoneNumbers( const KABC::PhoneNumber::List &list ); @@ -61,22 +62,27 @@ class PhoneEditWidget : public QScrollView // void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* ); //KABC::PhoneNumber currentPhoneNumber( KComboBox*, int ); signals: void modified(); void typeChange( int oldType, int newType ); private slots: + void bottomVisible(); + void addNumberInt( int ); void deleteEdit( PhoneTypeNumberEdit* ew ); void addNumber(); void pendingDelete(); protected: private: + QScrollView* sv; + QPopupMenu *mPopup; + int mPopupCount; PhoneTypeNumberEdit* mPendingDelete; void setDefaults(); PhoneTypeNumberEdit* appendEditCombo(); QWidget* mw; QVBoxLayout* mainLayout; QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList; KABC::PhoneNumber::List mPhoneList; @@ -221,30 +227,34 @@ public: } void setPhoneNumber( const KABC::PhoneNumber &phoneNumber ) { mPhoneNumber = phoneNumber; int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); mCombo->setCurrentItem( index ); mNumber->setText( mPhoneNumber.number() ); show(); - + mNumber->setFocus(); } KABC::PhoneNumber phoneNumber() { mPhoneNumber.setNumber( mNumber->text() ); int index = mCombo->currentItem(); mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); return mPhoneNumber; } bool isValid() { if ( mNumber->text().isEmpty() )return false; return true; } + int currentType() + { + return mCombo->currentItem(); + } private slots: void typeExternalChanged( int oldType, int newType ) { if ( mPhoneNumber.type() == newType ) { mPhoneNumber.setType(oldType); int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); mCombo->setCurrentItem( index ); } @@ -254,25 +264,22 @@ public: emit deleteMe( this ); } void comboTypeChange( int index ) { int old = mPhoneNumber.type(); int newT = PhoneNumber::supportedTypeList()[index]; if ( old != newT ) { emit modified(); + if ( newT != PhoneNumber::Voice ) emit typeChange ( old, newT ); mPhoneNumber.setType(newT ); } } - int currentType() - { - return mCombo->currentItem(); - } void textChanged ( const QString & ) { emit modified(); } signals: void typeChange( int oldType, int newType ); void modified(); void deleteMe( PhoneTypeNumberEdit* ); @@ -1 +1 @@ -version = "2.2.5"; +version = "2.2.6"; |