summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/phoneeditwidget.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h
index f61087b..5bb4226 100644
--- a/kaddressbook/phoneeditwidget.h
+++ b/kaddressbook/phoneeditwidget.h
@@ -1,126 +1,127 @@
1#ifndef PHONEEDITWIDGET_H 1#ifndef PHONEEDITWIDGET_H
2#define PHONEEDITWIDGET_H 2#define PHONEEDITWIDGET_H
3/* 3/*
4 This file is part of KAddressBook. 4 This file is part of KAddressBook.
5 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 5 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 20
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
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> 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#include <qpopupmenu.h>
31#include <qapplication.h>
31 32
32#include <qptrlist.h> 33#include <qptrlist.h>
33#include <qscrollview.h> 34#include <qscrollview.h>
34 35
35#include "addresseeconfig.h" 36#include "addresseeconfig.h"
36#include "typecombo.h" 37#include "typecombo.h"
37 38
38class QButtonGroup; 39class QButtonGroup;
39class QCheckBox; 40class QCheckBox;
40class PhoneTypeNumberEdit; 41class PhoneTypeNumberEdit;
41 42
42#include <klineedit.h> 43#include <klineedit.h>
43#include <kcombobox.h> 44#include <kcombobox.h>
44#include <kabc/phonenumber.h> 45#include <kabc/phonenumber.h>
45 46
46typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo; 47typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo;
47 48
48/** 49/**
49 Widget for editing phone numbers. 50 Widget for editing phone numbers.
50*/ 51*/
51class PhoneEditWidget : public QWidget 52class PhoneEditWidget : public QWidget
52{ 53{
53 Q_OBJECT 54 Q_OBJECT
54 55
55 public: 56 public:
56 PhoneEditWidget( QWidget *parent, const char *name = 0 ); 57 PhoneEditWidget( QWidget *parent, const char *name = 0 );
57 ~PhoneEditWidget(); 58 ~PhoneEditWidget();
58 59
59 void setPhoneNumbers( const KABC::PhoneNumber::List &list ); 60 void setPhoneNumbers( const KABC::PhoneNumber::List &list );
60 KABC::PhoneNumber::List phoneNumbers(); 61 KABC::PhoneNumber::List phoneNumbers();
61 62
62 // void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* ); 63 // void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* );
63 //KABC::PhoneNumber currentPhoneNumber( KComboBox*, int ); 64 //KABC::PhoneNumber currentPhoneNumber( KComboBox*, int );
64 65
65 signals: 66 signals:
66 void modified(); 67 void modified();
67 void typeChange( int oldType, int newType ); 68 void typeChange( int oldType, int newType );
68 69
69 private slots: 70 private slots:
70 void bottomVisible(); 71 void bottomVisible();
71 void addNumberInt( int ); 72 void addNumberInt( int );
72 void deleteEdit( PhoneTypeNumberEdit* ew ); 73 void deleteEdit( PhoneTypeNumberEdit* ew );
73 void addNumber(); 74 void addNumber();
74 void pendingDelete(); 75 void pendingDelete();
75 protected: 76 protected:
76 77
77 private: 78 private:
78 QScrollView* sv; 79 QScrollView* sv;
79 QPopupMenu *mPopup; 80 QPopupMenu *mPopup;
80 int mPopupCount; 81 int mPopupCount;
81 PhoneTypeNumberEdit* mPendingDelete; 82 PhoneTypeNumberEdit* mPendingDelete;
82 void setDefaults(); 83 void setDefaults();
83 PhoneTypeNumberEdit* appendEditCombo(); 84 PhoneTypeNumberEdit* appendEditCombo();
84 QWidget* mw; 85 QWidget* mw;
85 QVBoxLayout* mainLayout; 86 QVBoxLayout* mainLayout;
86 QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList; 87 QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList;
87 88
88}; 89};
89 90
90 91
91class PhoneTypeNumberEdit : public QWidget 92class PhoneTypeNumberEdit : public QWidget
92{ 93{
93 Q_OBJECT 94 Q_OBJECT
94public: 95public:
95 PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) :QWidget( parent ) 96 PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) :QWidget( parent )
96 { 97 {
97 QHBoxLayout * lay = new QHBoxLayout( this ); 98 QHBoxLayout * lay = new QHBoxLayout( this );
98 lay->setSpacing( 2 ); 99 lay->setSpacing( 2 );
99 lay->setMargin( 0 ); 100 lay->setMargin( 0 );
100 mMinusButton = new QPushButton ( this ); 101 mMinusButton = new QPushButton ( this );
101 mMinusButton->setPixmap ( SmallIcon("minus")); 102 mMinusButton->setPixmap ( SmallIcon("minus"));
102 mCombo = new KComboBox( this ); 103 mCombo = new KComboBox( this );
103 if ( QApplication::desktop()->width() <= 640 ) 104 if ( QApplication::desktop()->width() <= 640 )
104 mCombo->setSizeLimit ( 6 ); 105 mCombo->setSizeLimit ( 6 );
105 mNumber = new KLineEdit( this ); 106 mNumber = new KLineEdit( this );
106 mMinusButton->setMaximumHeight( mNumber->sizeHint().height() + 6); 107 mMinusButton->setMaximumHeight( mNumber->sizeHint().height() + 6);
107 lay->addWidget( mMinusButton ); 108 lay->addWidget( mMinusButton );
108 lay->addWidget( mCombo ); 109 lay->addWidget( mCombo );
109 lay->addWidget( mNumber ); 110 lay->addWidget( mNumber );
110 connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) ); 111 connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) );
111 connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) ); 112 connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) );
112 connect( mNumber , SIGNAL ( textChanged ( const QString & ) ), 113 connect( mNumber , SIGNAL ( textChanged ( const QString & ) ),
113 this, SLOT ( textChanged ( const QString & ) ) ); 114 this, SLOT ( textChanged ( const QString & ) ) );
114 mCombo->insertStringList( PhoneNumber::supportedTypeListNames() ); 115 mCombo->insertStringList( PhoneNumber::supportedTypeListNames() );
115 } 116 }
116 ~PhoneTypeNumberEdit() { 117 ~PhoneTypeNumberEdit() {
117 // qDebug("~PhoneTypeNumberEdit() "); 118 // qDebug("~PhoneTypeNumberEdit() ");
118 } 119 }
119 void setPhoneNumber( const KABC::PhoneNumber &phoneNumber ) 120 void setPhoneNumber( const KABC::PhoneNumber &phoneNumber )
120 { 121 {
121 mPhoneNumber = phoneNumber; 122 mPhoneNumber = phoneNumber;
122 int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); 123 int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() );
123 mCombo->setCurrentItem( index ); 124 mCombo->setCurrentItem( index );
124 mNumber->setText( mPhoneNumber.number() ); 125 mNumber->setText( mPhoneNumber.number() );
125 show(); 126 show();
126 mNumber->setFocus(); 127 mNumber->setFocus();