author | zautrix <zautrix> | 2005-10-28 08:57:25 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-28 08:57:25 (UTC) |
commit | f284eafbe4274cb97ec25f375544b924ae04ac09 (patch) (unidiff) | |
tree | bc754eac9882740463a447099944cbb590bad7f6 | |
parent | d934f3fe2a62f6a696992335124c4434cd77d990 (diff) | |
download | kdepimpi-f284eafbe4274cb97ec25f375544b924ae04ac09.zip kdepimpi-f284eafbe4274cb97ec25f375544b924ae04ac09.tar.gz kdepimpi-f284eafbe4274cb97ec25f375544b924ae04ac09.tar.bz2 |
cimmit
-rw-r--r-- | bin/kdepim/kaddressbook/germantranslation.txt | 4 | ||||
-rw-r--r-- | kabc/phonenumber.cpp | 26 | ||||
-rw-r--r-- | kabc/phonenumber.h | 3 | ||||
-rw-r--r-- | kaddressbook/addresseeeditorwidget.cpp | 34 | ||||
-rw-r--r-- | kaddressbook/phoneeditwidget.h | 79 |
5 files changed, 134 insertions, 12 deletions
diff --git a/bin/kdepim/kaddressbook/germantranslation.txt b/bin/kdepim/kaddressbook/germantranslation.txt index 2ae6eb9..dcf43c1 100644 --- a/bin/kdepim/kaddressbook/germantranslation.txt +++ b/bin/kdepim/kaddressbook/germantranslation.txt | |||
@@ -826,10 +826,10 @@ | |||
826 | { "Callback","Rückruf" }, | 826 | { "Callback","Rückruf" }, |
827 | { "Fax (Other)","Fax (Anderes)" }, | 827 | { "Fax (Other)","Fax (Anderes)" }, |
828 | { "Primary","Bevorzugt" }, | 828 | { "Primary","Bevorzugt" }, |
829 | { "Mobile (Home)","Handy (Privat)" }, | 829 | { "Mobile (Home)","Handy (Privat)" }, |
830 | { "","" }, | 830 | { "Unfiled","Nicht zugeordnet" }, |
831 | { "","" }, | 831 | { "Format.n.:","Format.N.:" }, |
832 | { "","" }, | 832 | { "","" }, |
833 | { "","" }, | 833 | { "","" }, |
834 | { "","" }, | 834 | { "","" }, |
835 | { "","" }, | 835 | { "","" }, |
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp index 0d46ba7..eee25a5 100644 --- a/kabc/phonenumber.cpp +++ b/kabc/phonenumber.cpp | |||
@@ -221,8 +221,34 @@ PhoneNumber::TypeList PhoneNumber::typeList() | |||
221 | << Bbs << Modem << Car << Isdn << Pcs << Pager; | 221 | << Bbs << Modem << Car << Isdn << Pcs << Pager; |
222 | 222 | ||
223 | return list; | 223 | return list; |
224 | } | 224 | } |
225 | PhoneNumber::TypeList PhoneNumber::supportedTypeList() | ||
226 | { | ||
227 | static TypeList list; | ||
228 | if ( list.count() == 0 ) | ||
229 | list << (Home| Pref) << (Work| Pref) << Cell << Home << Work << Car << (Work| Msg | Voice) << (Work| Msg) << (Home | Fax) << (Work| Fax) << Fax<< (Pcs|Pref)<< Pcs<< Pager << Isdn << Video << Msg << Pref << Voice; | ||
230 | return list; | ||
231 | } | ||
232 | QStringList PhoneNumber::supportedTypeListNames() | ||
233 | { | ||
234 | static QStringList list; | ||
235 | if ( list.count() == 0 ) | ||
236 | list << i18n("Home") << i18n("Work") << i18n("Mobile") << i18n("Home2")<< i18n("Work2") << i18n("Mobile2 (Work)") << i18n("Assistent") << i18n("Company") << i18n("Fax (Home)") << i18n("Fax (Work)") << i18n("Fax (Other)") << i18n("SIP") << i18n("VoIP") << i18n("Pager") << i18n("ISDN") << i18n("Video") << i18n("Callback") << i18n("Primary")<< i18n("Other"); | ||
237 | return list; | ||
238 | } | ||
239 | |||
240 | int PhoneNumber::typeListIndex4Type(int type ) | ||
241 | { | ||
242 | TypeList list = supportedTypeList(); | ||
243 | int i = 0; | ||
244 | while ( i < list.count() ) { | ||
245 | if ( list [i] == type ) | ||
246 | return i; | ||
247 | ++i; | ||
248 | } | ||
249 | return list.count()-1; | ||
250 | } | ||
225 | 251 | ||
226 | QString PhoneNumber::label( int type ) | 252 | QString PhoneNumber::label( int type ) |
227 | { | 253 | { |
228 | return typeLabel( type ); | 254 | return typeLabel( type ); |
diff --git a/kabc/phonenumber.h b/kabc/phonenumber.h index b9d6a17..feeba6c 100644 --- a/kabc/phonenumber.h +++ b/kabc/phonenumber.h | |||
@@ -147,8 +147,11 @@ class PhoneNumber | |||
147 | Returns the translated label for phone number type. | 147 | Returns the translated label for phone number type. |
148 | @obsolete | 148 | @obsolete |
149 | */ | 149 | */ |
150 | static QString label( int type ); | 150 | static QString label( int type ); |
151 | static TypeList supportedTypeList(); | ||
152 | static QStringList supportedTypeListNames(); | ||
153 | static int typeListIndex4Type(int type ); | ||
151 | bool simplifyNumber(); | 154 | bool simplifyNumber(); |
152 | void simplifyType(); | 155 | void simplifyType(); |
153 | void makeCompat(); | 156 | void makeCompat(); |
154 | int getCompatType( int type ); | 157 | int getCompatType( int type ); |
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp index 310d628..9814cd5 100644 --- a/kaddressbook/addresseeeditorwidget.cpp +++ b/kaddressbook/addresseeeditorwidget.cpp | |||
@@ -153,9 +153,16 @@ void AddresseeEditorWidget::setupTab1() | |||
153 | // This is the General tab | 153 | // This is the General tab |
154 | QWidget *tab1 = new QWidget( mTabWidget ); | 154 | QWidget *tab1 = new QWidget( mTabWidget ); |
155 | 155 | ||
156 | //US QGridLayout *layout = new QGridLayout( tab1, 11, 7 ); | 156 | //US QGridLayout *layout = new QGridLayout( tab1, 11, 7 ); |
157 | QGridLayout *layout = new QGridLayout( tab1, 7, 1 ); | 157 | bool horLayout = false; |
158 | int maxCol = 1; | ||
159 | if ( QApplication::desktop()->width() == 640 || QApplication::desktop()->width() == 320 ) { | ||
160 | horLayout = true; | ||
161 | maxCol = 3; | ||
162 | } | ||
163 | QGridLayout *layout = new QGridLayout( tab1, 8-maxCol, maxCol ); | ||
164 | |||
158 | layout->setMargin( KDialogBase::marginHintSmall() ); | 165 | layout->setMargin( KDialogBase::marginHintSmall() ); |
159 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 166 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
160 | 167 | ||
161 | QLabel *label; | 168 | QLabel *label; |
@@ -205,16 +212,27 @@ void AddresseeEditorWidget::setupTab1() | |||
205 | mOrgEdit = new KLineEdit( tab1 ); | 212 | mOrgEdit = new KLineEdit( tab1 ); |
206 | //label->setBuddy( mOrgEdit ); | 213 | //label->setBuddy( mOrgEdit ); |
207 | connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), | 214 | connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), |
208 | SLOT( textChanged( const QString& ) ) ); | 215 | SLOT( textChanged( const QString& ) ) ); |
209 | layout->addWidget( button, 2, 0 ); | 216 | if ( horLayout ) { |
210 | layout->addWidget( mOrgEdit, 2, 1 ); | 217 | layout->addWidget( button, 1, 2 ); |
218 | layout->addWidget( mOrgEdit, 1, 3 ); | ||
219 | |||
220 | } else { | ||
221 | layout->addWidget( button, 2, 0 ); | ||
222 | layout->addWidget( mOrgEdit, 2, 1 ); | ||
223 | } | ||
211 | 224 | ||
212 | // File as (formatted name) | 225 | // File as (formatted name) |
213 | label = new QLabel( i18n( "Formatted name:" ), tab1 ); | 226 | label = new QLabel( i18n( "Format.n.:" ), tab1 ); |
214 | mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); | 227 | mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); |
215 | layout->addWidget( label, 3, 0 ); | 228 | if ( horLayout ) { |
216 | layout->addWidget( mFormattedNameLabel, 3, 1 ); | 229 | layout->addWidget( label, 0,2 ); |
230 | layout->addWidget( mFormattedNameLabel, 0, 3 ); | ||
231 | } else { | ||
232 | layout->addWidget( label, 3, 0 ); | ||
233 | layout->addWidget( mFormattedNameLabel, 3, 1 ); | ||
234 | } | ||
217 | /* LR | 235 | /* LR |
218 | // Left hand separator. This separator doesn't go all the way | 236 | // Left hand separator. This separator doesn't go all the way |
219 | // across so the dialog still flows from top to bottom | 237 | // across so the dialog still flows from top to bottom |
220 | bar = new KSeparator( KSeparator::HLine, tab1 ); | 238 | bar = new KSeparator( KSeparator::HLine, tab1 ); |
@@ -239,9 +257,9 @@ void AddresseeEditorWidget::setupTab1() | |||
239 | iii = 7; | 257 | iii = 7; |
240 | #else | 258 | #else |
241 | iii = 8; | 259 | iii = 8; |
242 | #endif | 260 | #endif |
243 | layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, 1 ); | 261 | layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, maxCol ); |
244 | ++iii; | 262 | ++iii; |
245 | /* LR | 263 | /* LR |
246 | bar = new KSeparator( KSeparator::HLine, tab1 ); | 264 | bar = new KSeparator( KSeparator::HLine, tab1 ); |
247 | //US layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); | 265 | //US layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); |
@@ -320,9 +338,9 @@ void AddresseeEditorWidget::setupTab1() | |||
320 | mSecrecyWidget = new SecrecyWidget( categoryBox ); | 338 | mSecrecyWidget = new SecrecyWidget( categoryBox ); |
321 | connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 339 | connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
322 | 340 | ||
323 | //US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); | 341 | //US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); |
324 | layout->addMultiCellWidget( categoryBox, iii, iii, 0, 1 ); | 342 | layout->addMultiCellWidget( categoryBox, iii, iii, 0, maxCol ); |
325 | 343 | ||
326 | // Build the layout and add to the tab widget | 344 | // Build the layout and add to the tab widget |
327 | layout->activate(); // required | 345 | layout->activate(); // required |
328 | 346 | ||
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h index 7fe4bc0..0241cf0 100644 --- a/kaddressbook/phoneeditwidget.h +++ b/kaddressbook/phoneeditwidget.h | |||
@@ -23,18 +23,22 @@ | |||
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <kdialogbase.h> | 26 | #include <kdialogbase.h> |
27 | #include <kiconloader.h> | ||
28 | #include <qpushbutton.h> | ||
29 | #include <qlayout.h> | ||
30 | |||
27 | 31 | ||
28 | #include "addresseeconfig.h" | 32 | #include "addresseeconfig.h" |
29 | #include "typecombo.h" | 33 | #include "typecombo.h" |
30 | 34 | ||
31 | class QButtonGroup; | 35 | class QButtonGroup; |
32 | class QCheckBox; | 36 | class QCheckBox; |
33 | 37 | ||
38 | #include <klineedit.h> | ||
39 | #include <kcombobox.h> | ||
34 | class KListView; | 40 | class KListView; |
35 | class KLineEdit; | ||
36 | class KComboBox; | ||
37 | 41 | ||
38 | typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo; | 42 | typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo; |
39 | 43 | ||
40 | /** | 44 | /** |
@@ -142,6 +146,77 @@ private: | |||
142 | QButtonGroup *mGroup; | 146 | QButtonGroup *mGroup; |
143 | QCheckBox *mPreferredBox; | 147 | QCheckBox *mPreferredBox; |
144 | KLineEdit *mNumber; | 148 | KLineEdit *mNumber; |
145 | }; | 149 | }; |
150 | class PhoneTypeNumberEdit : public QWidget | ||
151 | { | ||
152 | Q_OBJECT | ||
153 | public: | ||
154 | PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) | ||
155 | { | ||
156 | QHBoxLayout * lay = new QHBoxLayout( this ); | ||
157 | lay->setSpacing( KDialogBase::spacingHintSmall() ); | ||
158 | lay->setMargin( KDialogBase::marginHintSmall() ); | ||
159 | mMinusButton = new QPushButton ( this ); | ||
160 | mMinusButton->setPixmap ( SmallIcon("minus")); | ||
161 | mCombo = new KComboBox( this ); | ||
162 | mNumber = new KLineEdit( this ); | ||
163 | lay->addWidget( mMinusButton ); | ||
164 | lay->addWidget( mCombo ); | ||
165 | lay->addWidget( mNumber ); | ||
166 | connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) ); | ||
167 | connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) ); | ||
168 | mCombo->insertStringList( PhoneNumber::supportedTypeListNames() ); | ||
169 | } | ||
170 | |||
171 | void setPhoneNumber( const KABC::PhoneNumber &phoneNumber ) | ||
172 | { | ||
173 | mPhoneNumber = phoneNumber; | ||
174 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); | ||
175 | mCombo->setCurrentItem( index ); | ||
176 | mNumber->setText( mPhoneNumber.number() ); | ||
177 | show(); | ||
178 | |||
179 | } | ||
180 | KABC::PhoneNumber phoneNumber() | ||
181 | { | ||
182 | mPhoneNumber.setNumber( mNumber->text() ); | ||
183 | int index = mCombo->currentItem(); | ||
184 | mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); | ||
185 | return mPhoneNumber; | ||
186 | |||
187 | } | ||
188 | private slots: | ||
189 | void typeExternalChanged( int oldType, int newType ) | ||
190 | { | ||
191 | if ( mPhoneNumber.type() == newType ) { | ||
192 | mPhoneNumber.setType(oldType); | ||
193 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); | ||
194 | mCombo->setCurrentItem( index ); | ||
195 | } | ||
196 | |||
197 | } | ||
198 | void deleteNumber() | ||
199 | { | ||
200 | hide(); | ||
201 | } | ||
202 | void comboTypeChange( int index ) | ||
203 | { | ||
204 | int old = mPhoneNumber.type(); | ||
205 | int newT = PhoneNumber::supportedTypeList()[index]; | ||
206 | if ( old != newT ) { | ||
207 | mPhoneNumber.setType(newT ); | ||
208 | emit typeChange ( old, newT ); | ||
209 | } | ||
210 | |||
211 | } | ||
212 | signals: | ||
213 | void typeChange( int oldType, int newType ); | ||
214 | |||
215 | private: | ||
216 | KABC::PhoneNumber mPhoneNumber; | ||
217 | QPushButton* mMinusButton; | ||
218 | KComboBox *mCombo; | ||
219 | KLineEdit *mNumber; | ||
220 | }; | ||
146 | 221 | ||
147 | #endif | 222 | #endif |