summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/kaddressbook/germantranslation.txt4
-rw-r--r--kabc/phonenumber.cpp26
-rw-r--r--kabc/phonenumber.h3
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp34
-rw-r--r--kaddressbook/phoneeditwidget.h79
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
@@ -818,20 +818,20 @@
{ "Home2","Privat2" },
{ "Work2","Arbeit2" },
{ "Fax (Work)","Fax (Arbeit)" },
{ "Fax (Home)","Fax (Privat)" },
{ "Assistent","Sekretär(in)" },
{ "Company","Firma" },
{ "Mobile2 (work)","Handy2 (Arbeit)" },
{ "Mobile2 (car)","Handy2 (Auto)" },
{ "Callback","Rückruf" },
{ "Fax (Other)","Fax (Anderes)" },
{ "Primary","Bevorzugt" },
{ "Mobile (Home)","Handy (Privat)" },
-{ "","" },
-{ "","" },
+{ "Unfiled","Nicht zugeordnet" },
+{ "Format.n.:","Format.N.:" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" }, \ No newline at end of file
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp
index 0d46ba7..eee25a5 100644
--- a/kabc/phonenumber.cpp
+++ b/kabc/phonenumber.cpp
@@ -213,24 +213,50 @@ QString PhoneNumber::label() const
return typeLabel( type() );
}
PhoneNumber::TypeList PhoneNumber::typeList()
{
TypeList list;
list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video
<< Bbs << Modem << Car << Isdn << Pcs << Pager;
return list;
}
+PhoneNumber::TypeList PhoneNumber::supportedTypeList()
+{
+ static TypeList list;
+ if ( list.count() == 0 )
+ 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;
+ return list;
+}
+QStringList PhoneNumber::supportedTypeListNames()
+{
+ static QStringList list;
+ if ( list.count() == 0 )
+ 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");
+ return list;
+}
+
+int PhoneNumber::typeListIndex4Type(int type )
+{
+ TypeList list = supportedTypeList();
+ int i = 0;
+ while ( i < list.count() ) {
+ if ( list [i] == type )
+ return i;
+ ++i;
+ }
+ return list.count()-1;
+}
QString PhoneNumber::label( int type )
{
return typeLabel( type );
}
QString PhoneNumber::typeLabel( int type )
{
if ((type & Cell) == Cell)
return i18n("Mobile");
if ((type & Home) == Home) {
if ((type & Pref) == Pref)
diff --git a/kabc/phonenumber.h b/kabc/phonenumber.h
index b9d6a17..feeba6c 100644
--- a/kabc/phonenumber.h
+++ b/kabc/phonenumber.h
@@ -139,24 +139,27 @@ class PhoneNumber
static TypeList typeList();
/**
Returns the translated label for phone number type.
*/
static QString typeLabel( int type );
/**
Returns the translated label for phone number type.
@obsolete
*/
static QString label( int type );
+ static TypeList supportedTypeList();
+ static QStringList supportedTypeListNames();
+ static int typeListIndex4Type(int type );
bool simplifyNumber();
void simplifyType();
void makeCompat();
int getCompatType( int type );
private:
void init();
QString mId;
int mType;
QString mNumber;
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 310d628..9814cd5 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -145,25 +145,32 @@ void AddresseeEditorWidget::initGUI()
mNameEdit->setFocus();
connect( mTabWidget, SIGNAL( currentChanged(QWidget*) ),
SLOT( pageChanged(QWidget*) ) );
}
void AddresseeEditorWidget::setupTab1()
{
// This is the General tab
QWidget *tab1 = new QWidget( mTabWidget );
//US QGridLayout *layout = new QGridLayout( tab1, 11, 7 );
- QGridLayout *layout = new QGridLayout( tab1, 7, 1 );
+ bool horLayout = false;
+ int maxCol = 1;
+ if ( QApplication::desktop()->width() == 640 || QApplication::desktop()->width() == 320 ) {
+ horLayout = true;
+ maxCol = 3;
+ }
+ QGridLayout *layout = new QGridLayout( tab1, 8-maxCol, maxCol );
+
layout->setMargin( KDialogBase::marginHintSmall() );
layout->setSpacing( KDialogBase::spacingHintSmall() );
QLabel *label;
KSeparator* bar;
QPushButton *button;
//////////////////////////////////
// Upper left group (person info)
// Person icon
/* LR
@@ -197,32 +204,43 @@ void AddresseeEditorWidget::setupTab1()
//label->setBuddy( mRoleEdit );
layout->addWidget( button, 1, 0 );
layout->addWidget( mRoleEdit, 1, 1 );
// Organization
button = new QPushButton( i18n( "Organization:" ), tab1 );
connect( button, SIGNAL( clicked() ), SLOT( setCompany2FN() ) );
//label = new QLabel( i18n( "Organization:" ), tab1 );
mOrgEdit = new KLineEdit( tab1 );
//label->setBuddy( mOrgEdit );
connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
- layout->addWidget( button, 2, 0 );
- layout->addWidget( mOrgEdit, 2, 1 );
+ if ( horLayout ) {
+ layout->addWidget( button, 1, 2 );
+ layout->addWidget( mOrgEdit, 1, 3 );
+
+ } else {
+ layout->addWidget( button, 2, 0 );
+ layout->addWidget( mOrgEdit, 2, 1 );
+ }
// File as (formatted name)
- label = new QLabel( i18n( "Formatted name:" ), tab1 );
+ label = new QLabel( i18n( "Format.n.:" ), tab1 );
mFormattedNameLabel = new KSqueezedTextLabel( tab1 );
- layout->addWidget( label, 3, 0 );
- layout->addWidget( mFormattedNameLabel, 3, 1 );
+ if ( horLayout ) {
+ layout->addWidget( label, 0,2 );
+ layout->addWidget( mFormattedNameLabel, 0, 3 );
+ } else {
+ layout->addWidget( label, 3, 0 );
+ layout->addWidget( mFormattedNameLabel, 3, 1 );
+ }
/* LR
// Left hand separator. This separator doesn't go all the way
// across so the dialog still flows from top to bottom
bar = new KSeparator( KSeparator::HLine, tab1 );
layout->addMultiCellWidget( bar, 4, 4, 0, 2 );
*/
//////////////////////////////////////
/* LR
// Phone numbers (upper right)
label = new QLabel( tab1 );
//US loadIcon call is ambiguous. Add one more parameter
@@ -231,25 +249,25 @@ void AddresseeEditorWidget::setupTab1()
//US layout->addMultiCellWidget( label, 0, 1, 3, 3 );
layout->addMultiCellWidget( label, 5, 6, 0, 0 );
*/
mPhoneEditWidget = new PhoneEditWidget( tab1 );
connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
//US layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 );
int iii;
#ifndef DESKTOP_VERSION
iii = 7;
#else
iii = 8;
#endif
- layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, 1 );
+ layout->addMultiCellWidget( mPhoneEditWidget, 4, iii, 0, maxCol );
++iii;
/* LR
bar = new KSeparator( KSeparator::HLine, tab1 );
//US layout->addMultiCellWidget( bar, 4, 4, 3, 6 );
layout->addMultiCellWidget( bar, 9, 9, 0, 2 );
*/
/*US
//////////////////////////////////////
// Addresses (lower left)
label = new QLabel( tab1 );
//US loadIcon call is ambiguous. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop ) );
@@ -312,25 +330,25 @@ void AddresseeEditorWidget::setupTab1()
button = new QPushButton( i18n( "Categories" ), categoryBox );
connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) );
mCategoryEdit = new KLineEdit( categoryBox );
mCategoryEdit->setReadOnly( true );
connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
mSecrecyWidget = new SecrecyWidget( categoryBox );
connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
//US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 );
- layout->addMultiCellWidget( categoryBox, iii, iii, 0, 1 );
+ layout->addMultiCellWidget( categoryBox, iii, iii, 0, maxCol );
// Build the layout and add to the tab widget
layout->activate(); // required
mTabWidget->addTab( tab1, i18n( "&General" ) );
}
void AddresseeEditorWidget::setRole2FN()
{
if ( mRoleEdit->text().isEmpty() ) return;
mFormattedNameType = NameEditDialog::CustomName;
mAddressee.setFormattedName( mRoleEdit->text() );
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h
index 7fe4bc0..0241cf0 100644
--- a/kaddressbook/phoneeditwidget.h
+++ b/kaddressbook/phoneeditwidget.h
@@ -15,34 +15,38 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
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 "addresseeconfig.h"
#include "typecombo.h"
class QButtonGroup;
class QCheckBox;
+#include <klineedit.h>
+#include <kcombobox.h>
class KListView;
-class KLineEdit;
-class KComboBox;
typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo;
/**
Widget for editing phone numbers.
*/
class PhoneEditWidget : public QWidget
{
Q_OBJECT
public:
PhoneEditWidget( QWidget *parent, const char *name = 0 );
@@ -134,14 +138,85 @@ public:
PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, QWidget *parent, const char *name = 0 );
KABC::PhoneNumber phoneNumber();
private:
KABC::PhoneNumber mPhoneNumber;
KABC::PhoneNumber::TypeList mTypeList;
QButtonGroup *mGroup;
QCheckBox *mPreferredBox;
KLineEdit *mNumber;
};
+class PhoneTypeNumberEdit : public QWidget
+{
+ Q_OBJECT
+public:
+ PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 )
+ {
+ QHBoxLayout * lay = new QHBoxLayout( this );
+ lay->setSpacing( KDialogBase::spacingHintSmall() );
+ lay->setMargin( KDialogBase::marginHintSmall() );
+ mMinusButton = new QPushButton ( this );
+ mMinusButton->setPixmap ( SmallIcon("minus"));
+ mCombo = new KComboBox( this );
+ mNumber = new KLineEdit( this );
+ lay->addWidget( mMinusButton );
+ lay->addWidget( mCombo );
+ lay->addWidget( mNumber );
+ connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) );
+ connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) );
+ mCombo->insertStringList( PhoneNumber::supportedTypeListNames() );
+ }
+
+ void setPhoneNumber( const KABC::PhoneNumber &phoneNumber )
+ {
+ mPhoneNumber = phoneNumber;
+ int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() );
+ mCombo->setCurrentItem( index );
+ mNumber->setText( mPhoneNumber.number() );
+ show();
+
+ }
+ KABC::PhoneNumber phoneNumber()
+ {
+ mPhoneNumber.setNumber( mNumber->text() );
+ int index = mCombo->currentItem();
+ mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] );
+ return mPhoneNumber;
+
+ }
+ private slots:
+ void typeExternalChanged( int oldType, int newType )
+ {
+ if ( mPhoneNumber.type() == newType ) {
+ mPhoneNumber.setType(oldType);
+ int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() );
+ mCombo->setCurrentItem( index );
+ }
+
+ }
+ void deleteNumber()
+ {
+ hide();
+ }
+ void comboTypeChange( int index )
+ {
+ int old = mPhoneNumber.type();
+ int newT = PhoneNumber::supportedTypeList()[index];
+ if ( old != newT ) {
+ mPhoneNumber.setType(newT );
+ emit typeChange ( old, newT );
+ }
+
+ }
+ signals:
+void typeChange( int oldType, int newType );
+
+private:
+ KABC::PhoneNumber mPhoneNumber;
+ QPushButton* mMinusButton;
+ KComboBox *mCombo;
+ KLineEdit *mNumber;
+};
#endif