summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-10-28 15:56:43 (UTC)
committer zautrix <zautrix>2005-10-28 15:56:43 (UTC)
commit869e4921d8b052c376b2769de44674a8c2d68221 (patch) (unidiff)
treec1a778f31832c93bbe366fd495ad4f38f9248f60
parentab099bc1be027fe01dc252a9d7a0f8821e782d65 (diff)
downloadkdepimpi-869e4921d8b052c376b2769de44674a8c2d68221.zip
kdepimpi-869e4921d8b052c376b2769de44674a8c2d68221.tar.gz
kdepimpi-869e4921d8b052c376b2769de44674a8c2d68221.tar.bz2
cf
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/phoneeditwidget.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp
index 66f0a5e..d895ea1 100644
--- a/kaddressbook/phoneeditwidget.cpp
+++ b/kaddressbook/phoneeditwidget.cpp
@@ -1,130 +1,131 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qtooltip.h> 26#include <qtooltip.h>
27#include <qpushbutton.h> 27#include <qpushbutton.h>
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#include <qcursor.h>
35#include <qtimer.h>
35 36
36#include <kbuttonbox.h> 37#include <kbuttonbox.h>
37#include <klistview.h> 38#include <klistview.h>
38#include <kapplication.h> 39#include <kapplication.h>
39#include <qapplication.h> 40#include <qapplication.h>
40#include <kconfig.h> 41#include <kconfig.h>
41#include <klineedit.h> 42#include <klineedit.h>
42#include <kcombobox.h> 43#include <kcombobox.h>
43#include <klocale.h> 44#include <klocale.h>
44#include <kdebug.h> 45#include <kdebug.h>
45#include <kglobal.h> 46#include <kglobal.h>
46#include <kiconloader.h> 47#include <kiconloader.h>
47 48
48#include <kabc/phonenumber.h> 49#include <kabc/phonenumber.h>
49 50
50#include "typecombo.h" 51#include "typecombo.h"
51 52
52#include "phoneeditwidget.h" 53#include "phoneeditwidget.h"
53 54
54PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) 55PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name )
55 : QWidget(parent,name) 56 : QWidget(parent,name)
56{ 57{
57 QGridLayout* gridLayout = new QGridLayout ( this, 2,2 ); 58 QGridLayout* gridLayout = new QGridLayout ( this, 2,2 );
58 59
59 QLabel *temp = new QLabel( "", this ); 60 QLabel *temp = new QLabel( "", this );
60 temp->setAlignment( Qt::AlignCenter ); 61 temp->setAlignment( Qt::AlignCenter );
61 temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); 62 temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
62 gridLayout->addWidget( temp, 1, 0 ); 63 gridLayout->addWidget( temp, 1, 0 );
63 QPushButton *addBut = new QPushButton ( "add", this ); 64 QPushButton *addBut = new QPushButton ( "add", this );
64 addBut->setPixmap ( SmallIcon("plus")); 65 addBut->setPixmap ( SmallIcon("plus"));
65 addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() ); 66 addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() );
66 connect(addBut,SIGNAL(clicked ()),SLOT(addNumber())); 67 connect(addBut,SIGNAL(clicked ()),SLOT(addNumber()));
67 gridLayout->addWidget( addBut, 0, 0 ); 68 gridLayout->addWidget( addBut, 0, 0 );
68 69
69 sv = new QScrollView( this ); 70 sv = new QScrollView( this );
70 sv->setFrameStyle ( QFrame::Panel | QFrame::Plain ); 71 sv->setFrameStyle ( QFrame::Panel | QFrame::Plain );
71 sv->setLineWidth ( 1 ); 72 sv->setLineWidth ( 1 );
72 sv->setMidLineWidth ( 1 ); 73 sv->setMidLineWidth ( 1 );
73 mw = new QWidget ( sv->viewport() ); 74 mw = new QWidget ( sv->viewport() );
74 sv->addChild(mw); 75 sv->addChild(mw);
75 sv->setResizePolicy( QScrollView::AutoOneFit ); 76 sv->setResizePolicy( QScrollView::AutoOneFit );
76 mainLayout = new QVBoxLayout ( mw ); 77 mainLayout = new QVBoxLayout ( mw );
77 mainLayout->setMargin( 2 ); 78 mainLayout->setMargin( 2 );
78 mainLayout->setSpacing( 2 ); 79 mainLayout->setSpacing( 2 );
79 gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 ); 80 gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 );
80 setDefaults(); 81 setDefaults();
81 mTypeNumberEditList.setAutoDelete( true ); 82 mTypeNumberEditList.setAutoDelete( true );
82 mPopup = new QPopupMenu( this ); 83 mPopup = new QPopupMenu( this );
83 QStringList list = PhoneNumber::supportedTypeListNames(); 84 QStringList list = PhoneNumber::supportedTypeListNames();
84 mPopupCount = list.count(); 85 mPopupCount = list.count();
85 int i = 0; 86 int i = 0;
86 while ( i < mPopupCount ) { 87 while ( i < mPopupCount ) {
87 mPopup->insertItem( list[ i ], i ); 88 mPopup->insertItem( list[ i ], i );
88 ++i; 89 ++i;
89 } 90 }
90 connect(mPopup,SIGNAL(activated(int)),this,SLOT(addNumberInt( int))); 91 connect(mPopup,SIGNAL(activated(int)),this,SLOT(addNumberInt( int)));
91 92
92} 93}
93 94
94PhoneEditWidget::~PhoneEditWidget() 95PhoneEditWidget::~PhoneEditWidget()
95{ 96{
96} 97}
97void PhoneEditWidget::setDefaults() 98void PhoneEditWidget::setDefaults()
98{ 99{
99 mTypeNumberEditList.clear(); 100 mTypeNumberEditList.clear();
100 PhoneTypeNumberEdit* edit = appendEditCombo(); 101 PhoneTypeNumberEdit* edit = appendEditCombo();
101 KABC::PhoneNumber phoneNumber; 102 KABC::PhoneNumber phoneNumber;
102 phoneNumber.setType( KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref ); 103 phoneNumber.setType( KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref );
103 edit->setPhoneNumber( phoneNumber ); 104 edit->setPhoneNumber( phoneNumber );
104 edit = appendEditCombo(); 105 edit = appendEditCombo();
105 phoneNumber.setType( KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref ); 106 phoneNumber.setType( KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref );
106 edit->setPhoneNumber( phoneNumber ); 107 edit->setPhoneNumber( phoneNumber );
107 edit = appendEditCombo(); 108 edit = appendEditCombo();
108 phoneNumber.setType( KABC::PhoneNumber::Cell ); 109 phoneNumber.setType( KABC::PhoneNumber::Cell );
109 edit->setPhoneNumber( phoneNumber ); 110 edit->setPhoneNumber( phoneNumber );
110 111
111} 112}
112void PhoneEditWidget::addNumberInt( int index ) 113void PhoneEditWidget::addNumberInt( int index )
113{ 114{
114 PhoneTypeNumberEdit* edit = appendEditCombo(); 115 PhoneTypeNumberEdit* edit = appendEditCombo();
115 KABC::PhoneNumber phoneNumber; 116 KABC::PhoneNumber phoneNumber;
116 phoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); 117 phoneNumber.setType( PhoneNumber::supportedTypeList()[index] );
117 edit->setPhoneNumber( phoneNumber ); 118 edit->setPhoneNumber( phoneNumber );
118 //verticalScrollBar()->setValue( 1024); 119 //verticalScrollBar()->setValue( 1024);
119 QTimer::singleShot( 0, this, SLOT ( bottomVisible() ) ); 120 QTimer::singleShot( 0, this, SLOT ( bottomVisible() ) );
120} 121}
121void PhoneEditWidget::bottomVisible() 122void PhoneEditWidget::bottomVisible()
122{ 123{
123 sv->setContentsPos ( 0, 1024 ); 124 sv->setContentsPos ( 0, 1024 );
124} 125}
125void PhoneEditWidget::addNumber() 126void PhoneEditWidget::addNumber()
126{ 127{
127 int i = 0; 128 int i = 0;
128 while ( i < mPopupCount ) { 129 while ( i < mPopupCount ) {
129 mPopup->setItemEnabled( i, true ); 130 mPopup->setItemEnabled( i, true );
130 ++i; 131 ++i;