-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 | 21 | ||||
-rw-r--r-- | version | 2 |
5 files changed, 75 insertions, 32 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,9 +1,9 @@ | |||
1 | Summary: A collection of PIM programs | 1 | Summary: A collection of PIM programs |
2 | Name: KDE-Pim-Pi | 2 | Name: KDE-Pim-Pi |
3 | Version: 2.2.5 | 3 | Version: 2.2.6 |
4 | Release: SuSE_9.2 | 4 | Release: SuSE_9.2 |
5 | Copyright:GPL | 5 | Copyright:GPL |
6 | Group: Productivity/Pim | 6 | Group: Productivity/Pim |
7 | Source:http://sourceforge.net/projects/kdepimpi/ | 7 | Source:http://sourceforge.net/projects/kdepimpi/ |
8 | URL:http://sourceforge.net/projects/kdepimpi/ | 8 | URL:http://sourceforge.net/projects/kdepimpi/ |
9 | Packager: zautrix | 9 | Packager: zautrix |
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp index 9814cd5..966efa5 100644 --- a/kaddressbook/addresseeeditorwidget.cpp +++ b/kaddressbook/addresseeeditorwidget.cpp | |||
@@ -1185,13 +1185,13 @@ void AddresseeEditorWidget::save() | |||
1185 | mAddressee.removePhoneNumber( *phoneIter ); | 1185 | mAddressee.removePhoneNumber( *phoneIter ); |
1186 | 1186 | ||
1187 | phoneNumbers = mPhoneEditWidget->phoneNumbers(); | 1187 | phoneNumbers = mPhoneEditWidget->phoneNumbers(); |
1188 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); | 1188 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); |
1189 | ++phoneIter ) | 1189 | ++phoneIter ) |
1190 | mAddressee.insertPhoneNumber( *phoneIter ); | 1190 | mAddressee.insertPhoneNumber( *phoneIter ); |
1191 | 1191 | mAddressee.makePhoneNumbersOLcompatible(); | |
1192 | // Save the addresses | 1192 | // Save the addresses |
1193 | KABC::Address::List addresses; | 1193 | KABC::Address::List addresses; |
1194 | KABC::Address::List::Iterator addressIter; | 1194 | KABC::Address::List::Iterator addressIter; |
1195 | addresses = mAddressee.addresses(); | 1195 | addresses = mAddressee.addresses(); |
1196 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); | 1196 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); |
1197 | ++addressIter ) | 1197 | ++addressIter ) |
diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp index 997fc05..9e7e221 100644 --- a/kaddressbook/phoneeditwidget.cpp +++ b/kaddressbook/phoneeditwidget.cpp | |||
@@ -28,12 +28,13 @@ | |||
28 | #include <qcheckbox.h> | 28 | #include <qcheckbox.h> |
29 | #include <qstring.h> | 29 | #include <qstring.h> |
30 | #include <qlistbox.h> | 30 | #include <qlistbox.h> |
31 | #include <qlistview.h> | 31 | #include <qlistview.h> |
32 | #include <qbuttongroup.h> | 32 | #include <qbuttongroup.h> |
33 | #include <qhbox.h> | 33 | #include <qhbox.h> |
34 | #include <qcursor.h> | ||
34 | 35 | ||
35 | #include <kbuttonbox.h> | 36 | #include <kbuttonbox.h> |
36 | #include <klistview.h> | 37 | #include <klistview.h> |
37 | #include <kapplication.h> | 38 | #include <kapplication.h> |
38 | #include <qapplication.h> | 39 | #include <qapplication.h> |
39 | #include <kconfig.h> | 40 | #include <kconfig.h> |
@@ -48,38 +49,49 @@ | |||
48 | 49 | ||
49 | #include "typecombo.h" | 50 | #include "typecombo.h" |
50 | 51 | ||
51 | #include "phoneeditwidget.h" | 52 | #include "phoneeditwidget.h" |
52 | 53 | ||
53 | PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) | 54 | PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) |
54 | : QScrollView(parent,name) | 55 | : QWidget(parent,name) |
55 | { | 56 | { |
56 | setFrameStyle ( QFrame::Panel | QFrame::Plain ); | 57 | QGridLayout* gridLayout = new QGridLayout ( this, 2,2 ); |
57 | setLineWidth ( 1 ); | 58 | |
58 | setMidLineWidth ( 1 ); | 59 | QLabel *temp = new QLabel( "", this ); |
59 | mw = new QWidget ( viewport() ); | 60 | temp->setAlignment( Qt::AlignCenter ); |
60 | addChild(mw); | 61 | temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); |
61 | setResizePolicy( AutoOneFit ); | 62 | gridLayout->addWidget( temp, 1, 0 ); |
63 | QPushButton *addBut = new QPushButton ( "add", this ); | ||
64 | addBut->setPixmap ( SmallIcon("plus")); | ||
65 | addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() ); | ||
66 | connect(addBut,SIGNAL(clicked ()),SLOT(addNumber())); | ||
67 | gridLayout->addWidget( addBut, 0, 0 ); | ||
68 | |||
69 | sv = new QScrollView( this ); | ||
70 | sv->setFrameStyle ( QFrame::Panel | QFrame::Plain ); | ||
71 | sv->setLineWidth ( 1 ); | ||
72 | sv->setMidLineWidth ( 1 ); | ||
73 | mw = new QWidget ( sv->viewport() ); | ||
74 | sv->addChild(mw); | ||
75 | sv->setResizePolicy( QScrollView::AutoOneFit ); | ||
62 | mainLayout = new QVBoxLayout ( mw ); | 76 | mainLayout = new QVBoxLayout ( mw ); |
63 | mainLayout->setMargin( 2 ); | 77 | mainLayout->setMargin( 2 ); |
64 | mainLayout->setSpacing( 2 ); | 78 | mainLayout->setSpacing( 2 ); |
65 | QWidget* hb = new QWidget ( mw ); | 79 | gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 ); |
66 | mainLayout->add( hb ); | ||
67 | QHBoxLayout* hbLayout = new QHBoxLayout ( hb ); | ||
68 | QPushButton *addBut = new QPushButton ( "add", hb ); | ||
69 | hbLayout->add( addBut ); | ||
70 | addBut->setPixmap ( SmallIcon("plus")); | ||
71 | addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() ); | ||
72 | connect(addBut,SIGNAL(clicked()),SLOT(addNumber())); | ||
73 | //QLabel * temp = new QLabel( i18n("Phone Type"), hb ); | ||
74 | QLabel *temp = new QLabel( i18n("Phone Number"),hb ); | ||
75 | temp->setAlignment( Qt::AlignCenter ); | ||
76 | temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); | ||
77 | hbLayout->add( temp ); | ||
78 | setDefaults(); | 80 | setDefaults(); |
79 | mTypeNumberEditList.setAutoDelete( true ); | 81 | mTypeNumberEditList.setAutoDelete( true ); |
82 | mPopup = new QPopupMenu( this ); | ||
83 | QStringList list = PhoneNumber::supportedTypeListNames(); | ||
84 | mPopupCount = list.count(); | ||
85 | int i = 0; | ||
86 | while ( i < mPopupCount ) { | ||
87 | mPopup->insertItem( list[ i ], i ); | ||
88 | ++i; | ||
89 | } | ||
90 | connect(mPopup,SIGNAL(activated(int)),this,SLOT(addNumberInt( int))); | ||
91 | |||
80 | } | 92 | } |
81 | 93 | ||
82 | PhoneEditWidget::~PhoneEditWidget() | 94 | PhoneEditWidget::~PhoneEditWidget() |
83 | { | 95 | { |
84 | } | 96 | } |
85 | void PhoneEditWidget::setDefaults() | 97 | void PhoneEditWidget::setDefaults() |
@@ -94,15 +106,39 @@ void PhoneEditWidget::setDefaults() | |||
94 | edit->setPhoneNumber( phoneNumber ); | 106 | edit->setPhoneNumber( phoneNumber ); |
95 | edit = appendEditCombo(); | 107 | edit = appendEditCombo(); |
96 | phoneNumber.setType( KABC::PhoneNumber::Cell ); | 108 | phoneNumber.setType( KABC::PhoneNumber::Cell ); |
97 | edit->setPhoneNumber( phoneNumber ); | 109 | edit->setPhoneNumber( phoneNumber ); |
98 | 110 | ||
99 | } | 111 | } |
112 | void PhoneEditWidget::addNumberInt( int index ) | ||
113 | { | ||
114 | PhoneTypeNumberEdit* edit = appendEditCombo(); | ||
115 | KABC::PhoneNumber phoneNumber; | ||
116 | phoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); | ||
117 | edit->setPhoneNumber( phoneNumber ); | ||
118 | //verticalScrollBar()->setValue( 1024); | ||
119 | QTimer::singleShot( 0, this, SLOT ( bottomVisible() ) ); | ||
120 | } | ||
121 | void PhoneEditWidget::bottomVisible() | ||
122 | { | ||
123 | sv->setContentsPos ( 0, 1024 ); | ||
124 | } | ||
100 | void PhoneEditWidget::addNumber() | 125 | void PhoneEditWidget::addNumber() |
101 | { | 126 | { |
102 | 127 | int i = 0; | |
128 | while ( i < mPopupCount ) { | ||
129 | mPopup->setItemEnabled( i, true ); | ||
130 | ++i; | ||
131 | } | ||
132 | PhoneTypeNumberEdit* edit = mTypeNumberEditList.first(); | ||
133 | while ( edit ) { | ||
134 | if ( edit->currentType() < mPopupCount -1 ) | ||
135 | mPopup->setItemEnabled( edit->currentType(), false ); | ||
136 | edit = mTypeNumberEditList.next(); | ||
137 | } | ||
138 | mPopup->popup( QCursor::pos() ); | ||
103 | } | 139 | } |
104 | PhoneTypeNumberEdit* PhoneEditWidget::appendEditCombo() | 140 | PhoneTypeNumberEdit* PhoneEditWidget::appendEditCombo() |
105 | { | 141 | { |
106 | PhoneTypeNumberEdit* edit = new PhoneTypeNumberEdit( mw ); | 142 | PhoneTypeNumberEdit* edit = new PhoneTypeNumberEdit( mw ); |
107 | connect ( edit, SIGNAL ( typeChange( int , int) ), this, SIGNAL ( typeChange( int , int)) ); | 143 | connect ( edit, SIGNAL ( typeChange( int , int) ), this, SIGNAL ( typeChange( int , int)) ); |
108 | connect ( edit, SIGNAL ( modified() ), this, SIGNAL ( modified() ) ); | 144 | connect ( edit, SIGNAL ( modified() ), this, SIGNAL ( modified() ) ); |
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h index c730c7b..df5aff9 100644 --- a/kaddressbook/phoneeditwidget.h +++ b/kaddressbook/phoneeditwidget.h | |||
@@ -24,12 +24,13 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <kdialogbase.h> | 26 | #include <kdialogbase.h> |
27 | #include <kiconloader.h> | 27 | #include <kiconloader.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qpopupmenu.h> | ||
30 | 31 | ||
31 | #include <qptrlist.h> | 32 | #include <qptrlist.h> |
32 | #include <qscrollview.h> | 33 | #include <qscrollview.h> |
33 | 34 | ||
34 | #include "addresseeconfig.h" | 35 | #include "addresseeconfig.h" |
35 | #include "typecombo.h" | 36 | #include "typecombo.h" |
@@ -44,13 +45,13 @@ class PhoneTypeNumberEdit; | |||
44 | 45 | ||
45 | typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo; | 46 | typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo; |
46 | 47 | ||
47 | /** | 48 | /** |
48 | Widget for editing phone numbers. | 49 | Widget for editing phone numbers. |
49 | */ | 50 | */ |
50 | class PhoneEditWidget : public QScrollView | 51 | class PhoneEditWidget : public QWidget |
51 | { | 52 | { |
52 | Q_OBJECT | 53 | Q_OBJECT |
53 | 54 | ||
54 | public: | 55 | public: |
55 | PhoneEditWidget( QWidget *parent, const char *name = 0 ); | 56 | PhoneEditWidget( QWidget *parent, const char *name = 0 ); |
56 | ~PhoneEditWidget(); | 57 | ~PhoneEditWidget(); |
@@ -63,18 +64,23 @@ class PhoneEditWidget : public QScrollView | |||
63 | 64 | ||
64 | signals: | 65 | signals: |
65 | void modified(); | 66 | void modified(); |
66 | void typeChange( int oldType, int newType ); | 67 | void typeChange( int oldType, int newType ); |
67 | 68 | ||
68 | private slots: | 69 | private slots: |
70 | void bottomVisible(); | ||
71 | void addNumberInt( int ); | ||
69 | void deleteEdit( PhoneTypeNumberEdit* ew ); | 72 | void deleteEdit( PhoneTypeNumberEdit* ew ); |
70 | void addNumber(); | 73 | void addNumber(); |
71 | void pendingDelete(); | 74 | void pendingDelete(); |
72 | protected: | 75 | protected: |
73 | 76 | ||
74 | private: | 77 | private: |
78 | QScrollView* sv; | ||
79 | QPopupMenu *mPopup; | ||
80 | int mPopupCount; | ||
75 | PhoneTypeNumberEdit* mPendingDelete; | 81 | PhoneTypeNumberEdit* mPendingDelete; |
76 | void setDefaults(); | 82 | void setDefaults(); |
77 | PhoneTypeNumberEdit* appendEditCombo(); | 83 | PhoneTypeNumberEdit* appendEditCombo(); |
78 | QWidget* mw; | 84 | QWidget* mw; |
79 | QVBoxLayout* mainLayout; | 85 | QVBoxLayout* mainLayout; |
80 | QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList; | 86 | QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList; |
@@ -223,13 +229,13 @@ public: | |||
223 | { | 229 | { |
224 | mPhoneNumber = phoneNumber; | 230 | mPhoneNumber = phoneNumber; |
225 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); | 231 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); |
226 | mCombo->setCurrentItem( index ); | 232 | mCombo->setCurrentItem( index ); |
227 | mNumber->setText( mPhoneNumber.number() ); | 233 | mNumber->setText( mPhoneNumber.number() ); |
228 | show(); | 234 | show(); |
229 | 235 | mNumber->setFocus(); | |
230 | } | 236 | } |
231 | KABC::PhoneNumber phoneNumber() | 237 | KABC::PhoneNumber phoneNumber() |
232 | { | 238 | { |
233 | mPhoneNumber.setNumber( mNumber->text() ); | 239 | mPhoneNumber.setNumber( mNumber->text() ); |
234 | int index = mCombo->currentItem(); | 240 | int index = mCombo->currentItem(); |
235 | mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); | 241 | mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); |
@@ -237,12 +243,16 @@ public: | |||
237 | } | 243 | } |
238 | bool isValid() | 244 | bool isValid() |
239 | { | 245 | { |
240 | if ( mNumber->text().isEmpty() )return false; | 246 | if ( mNumber->text().isEmpty() )return false; |
241 | return true; | 247 | return true; |
242 | } | 248 | } |
249 | int currentType() | ||
250 | { | ||
251 | return mCombo->currentItem(); | ||
252 | } | ||
243 | private slots: | 253 | private slots: |
244 | void typeExternalChanged( int oldType, int newType ) | 254 | void typeExternalChanged( int oldType, int newType ) |
245 | { | 255 | { |
246 | if ( mPhoneNumber.type() == newType ) { | 256 | if ( mPhoneNumber.type() == newType ) { |
247 | mPhoneNumber.setType(oldType); | 257 | mPhoneNumber.setType(oldType); |
248 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); | 258 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); |
@@ -256,21 +266,18 @@ public: | |||
256 | void comboTypeChange( int index ) | 266 | void comboTypeChange( int index ) |
257 | { | 267 | { |
258 | int old = mPhoneNumber.type(); | 268 | int old = mPhoneNumber.type(); |
259 | int newT = PhoneNumber::supportedTypeList()[index]; | 269 | int newT = PhoneNumber::supportedTypeList()[index]; |
260 | if ( old != newT ) { | 270 | if ( old != newT ) { |
261 | emit modified(); | 271 | emit modified(); |
262 | emit typeChange ( old, newT ); | 272 | if ( newT != PhoneNumber::Voice ) |
273 | emit typeChange ( old, newT ); | ||
263 | mPhoneNumber.setType(newT ); | 274 | mPhoneNumber.setType(newT ); |
264 | } | 275 | } |
265 | 276 | ||
266 | } | 277 | } |
267 | int currentType() | ||
268 | { | ||
269 | return mCombo->currentItem(); | ||
270 | } | ||
271 | void textChanged ( const QString & ) | 278 | void textChanged ( const QString & ) |
272 | { | 279 | { |
273 | emit modified(); | 280 | emit modified(); |
274 | } | 281 | } |
275 | signals: | 282 | signals: |
276 | void typeChange( int oldType, int newType ); | 283 | void typeChange( int oldType, int newType ); |
@@ -1 +1 @@ | |||
version = "2.2.5"; | version = "2.2.6"; | ||