summaryrefslogtreecommitdiffabout
path: root/kaddressbook/phoneeditwidget.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/phoneeditwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/phoneeditwidget.cpp60
1 files changed, 33 insertions, 27 deletions
diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp
index df3b551..3661677 100644
--- a/kaddressbook/phoneeditwidget.cpp
+++ b/kaddressbook/phoneeditwidget.cpp
@@ -24,19 +24,25 @@
#include <qlayout.h>
#include <qlabel.h>
#include <qtooltip.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qstring.h>
-#include <qlistbox.h>
-#include <qlistview.h>
-#include <qbuttongroup.h>
-#include <qhbox.h>
+#include <q3listbox.h>
+#include <q3listview.h>
+#include <q3buttongroup.h>
+#include <q3hbox.h>
#include <qcursor.h>
#include <qtimer.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3GridLayout>
+#include <Q3Frame>
+#include <Q3PopupMenu>
+#include <Q3VBoxLayout>
#include <kbuttonbox.h>
#include <klistview.h>
#include <kapplication.h>
#include <qapplication.h>
#include <kconfig.h>
@@ -54,30 +60,30 @@
#include "phoneeditwidget.h"
PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name )
: QWidget(parent,name)
{
- QGridLayout* gridLayout = new QGridLayout ( this, 2,2 );
+ Q3GridLayout* gridLayout = new Q3GridLayout ( this, 2,2 );
QLabel *temp = new QLabel( "", this );
temp->setAlignment( Qt::AlignCenter );
temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
QPushButton *addBut = new QPushButton ( "add", this );
addBut->setPixmap ( SmallIcon("plus"));
addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() );
connect(addBut,SIGNAL(clicked ()),SLOT(addNumber()));
- sv = new QScrollView( this );
- sv->setFrameStyle ( QFrame::Plain );
+ sv = new Q3ScrollView( this );
+ sv->setFrameStyle ( Q3Frame::Plain );
sv->setLineWidth ( 0 );
sv->setMidLineWidth ( 0 );
mw = new QWidget ( sv->viewport() );
sv->addChild(mw);
- sv->setResizePolicy( QScrollView::AutoOneFit );
- mainLayout = new QVBoxLayout ( mw );
+ sv->setResizePolicy( Q3ScrollView::AutoOneFit );
+ mainLayout = new Q3VBoxLayout ( mw );
mainLayout->setMargin( 0 );
mainLayout->setSpacing( 0 );
gridLayout->setMargin( 2 );
gridLayout->setSpacing( 4 );
if ( QApplication::desktop()->width() == 240 || QApplication::desktop()->width() == 480 ) {
gridLayout->addWidget( addBut, 0, 0 );
@@ -87,13 +93,13 @@ PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name )
gridLayout->addWidget( temp, 1, 0 );
gridLayout->addWidget( addBut, 0, 0 );
gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 );
}
setDefaults();
mTypeNumberEditList.setAutoDelete( true );
- mPopup = new QPopupMenu( this );
+ mPopup = new Q3PopupMenu( this );
QStringList list = PhoneNumber::supportedTypeListNames();
mPopupCount = list.count();
int i = 0;
while ( i < mPopupCount ) {
mPopup->insertItem( list[ i ], i );
++i;
@@ -223,23 +229,23 @@ KABC::PhoneNumber::List PhoneEditWidget::phoneNumbers()
}
#if 0
PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
- QGridLayout *layout = new QGridLayout( this, 4, 1 );
+ Q3GridLayout *layout = new Q3GridLayout( this, 4, 1 );
//US layout->setSpacing( KDialog::spacingHint() );
layout->setSpacing( KDialogBase::spacingHintSmall() );
QLabel* label = new QLabel( this );
//US loadIcon call is ambiguous. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
- label->setAlignment( AlignCenter );
+ label->setAlignment( Qt::AlignCenter );
//US layout->addMultiCellWidget( label, 0, 1, 3, 3 );
layout->addWidget( label, 0, 0 );
QPushButton *editButton = new QPushButton( i18n( "Edit Phone Numbers..." ),
this );
if ( QApplication::desktop()->width() < 640 )
@@ -324,23 +330,23 @@ void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &list )
{
mPhoneList.clear();
// Insert types for existing numbers.
mPrefCombo->insertTypeList( list );
- QValueList<int> defaultTypes;
+ Q3ValueList<int> defaultTypes;
defaultTypes << KABC::PhoneNumber::Home;
defaultTypes << KABC::PhoneNumber::Work;
defaultTypes << KABC::PhoneNumber::Cell;
defaultTypes << ( KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax );
defaultTypes << ( KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax );
// Insert default types.
// Doing this for mPrefCombo is enough because the list is shared by all
// combos.
- QValueList<int>::ConstIterator it;
+ Q3ValueList<int>::ConstIterator it;
for( it = defaultTypes.begin(); it != defaultTypes.end(); ++it ) {
if ( !mPrefCombo->hasType( *it ) )
mPrefCombo->insertType( list, *it, PhoneNumber( "", *it ) );
}
updateCombos();
@@ -484,16 +490,16 @@ void PhoneEditWidget::updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *ot
}
}
///////////////////////////////////////////
// PhoneEditDialog
-class PhoneViewItem : public QListViewItem
+class PhoneViewItem : public Q3ListViewItem
{
public:
- PhoneViewItem( QListView *parent, const KABC::PhoneNumber &number );
+ PhoneViewItem( Q3ListView *parent, const KABC::PhoneNumber &number );
void setPhoneNumber( const KABC::PhoneNumber &number )
{
mPhoneNumber = number;
makeText();
}
@@ -508,14 +514,14 @@ public:
private:
void makeText();
KABC::PhoneNumber mPhoneNumber;
};
-PhoneViewItem::PhoneViewItem( QListView *parent, const KABC::PhoneNumber &number )
- : QListViewItem( parent ), mPhoneNumber( number )
+PhoneViewItem::PhoneViewItem( Q3ListView *parent, const KABC::PhoneNumber &number )
+ : Q3ListViewItem( parent ), mPhoneNumber( number )
{
#ifdef DESKTOP_VERSION
setRenameEnabled ( 0, true );
#endif
makeText();
}
@@ -541,34 +547,34 @@ PhoneEditDialog::PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *
parent, name, true)
{
mPhoneNumberList = list;
QWidget *page = plainPage();
- QGridLayout *layout = new QGridLayout( page, 1, 2 );
+ Q3GridLayout *layout = new Q3GridLayout( page, 1, 2 );
layout->setSpacing( spacingHint() );
mListView = new KListView( page );
mListView->setAllColumnsShowFocus( true );
mListView->addColumn( i18n( "Number" ) );
mListView->addColumn( i18n( "Type" ) );
- KButtonBox *buttonBox = new KButtonBox( page, Vertical );
+ KButtonBox *buttonBox = new KButtonBox( page, Qt::Vertical );
buttonBox->addButton( i18n( "&Add..." ), this, SLOT( slotAddPhoneNumber() ) );
mEditButton = buttonBox->addButton( i18n( "&Edit..." ), this, SLOT( slotEditPhoneNumber() ) );
mEditButton->setEnabled( false );
mRemoveButton = buttonBox->addButton( i18n( "&Remove" ), this, SLOT( slotRemovePhoneNumber() ) );
mRemoveButton->setEnabled( false );
buttonBox->layout();
layout->addWidget( mListView, 0, 0 );
layout->addWidget( buttonBox, 0, 1 );
connect( mListView, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()) );
- connect( mListView, SIGNAL(doubleClicked( QListViewItem *, const QPoint &, int )), this, SLOT( slotEditPhoneNumber()));
+ connect( mListView, SIGNAL(doubleClicked( Q3ListViewItem *, const QPoint &, int )), this, SLOT( slotEditPhoneNumber()));
KABC::PhoneNumber::List::Iterator it;
for ( it = mPhoneNumberList.begin(); it != mPhoneNumberList.end(); ++it )
new PhoneViewItem( mListView, *it );
if (QApplication::desktop()->width() < 480 )
showMaximized();
@@ -585,13 +591,13 @@ PhoneEditDialog::~PhoneEditDialog()
void PhoneEditDialog::slotAddPhoneNumber()
{
KABC::PhoneNumber tmp( "", 0 );
PhoneTypeDialog dlg( tmp, this );
if ( dlg.exec() ) {
- QListViewItem* i = mListView->firstChild();
+ Q3ListViewItem* i = mListView->firstChild();
KABC::PhoneNumber phoneNumber = dlg.phoneNumber();
bool insert = true;
while ( i ) {
PhoneViewItem* p = ( PhoneViewItem* ) i;
KABC::PhoneNumber pn = p->phoneNumber();
if ( (pn.type() | KABC::PhoneNumber::Pref) == (phoneNumber.type() | KABC::PhoneNumber::Pref) ) {
@@ -617,13 +623,13 @@ void PhoneEditDialog::slotRemovePhoneNumber()
{
PhoneViewItem *item = static_cast<PhoneViewItem*>( mListView->currentItem() );
if ( !item )
return;
mPhoneNumberList.remove( item->phoneNumber() );
- QListViewItem *currItem = mListView->currentItem();
+ Q3ListViewItem *currItem = mListView->currentItem();
mListView->takeItem( currItem );
delete currItem;
mChanged = true;
}
@@ -670,23 +676,23 @@ PhoneTypeDialog::PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber,
: KDialogBase( KDialogBase::Plain, i18n( "Edit Phone Number" ),
KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok,
parent, name, true), mPhoneNumber( phoneNumber )
{
QWidget *page = plainPage();
QLabel *label = 0;
- QGridLayout *layout = new QGridLayout( page, 3, 2, marginHint(), spacingHint() );
+ Q3GridLayout *layout = new Q3GridLayout( page, 3, 2, marginHint(), spacingHint() );
label = new QLabel( i18n( "Number:" ), page );
layout->addWidget( label, 0, 0 );
mNumber = new KLineEdit( page );
layout->addWidget( mNumber, 0, 1 );
mPreferredBox = new QCheckBox( i18n( "This is the preferred phone number" ), page );
layout->addMultiCellWidget( mPreferredBox, 1, 1, 0, 1 );
- mGroup = new QButtonGroup( 2, Horizontal, i18n( "Types" ), page );
+ mGroup = new Q3ButtonGroup( 2, Qt::Horizontal, i18n( "Types" ), page );
layout->addMultiCellWidget( mGroup, 2, 2, 0, 1 );
// fill widgets
mNumber->setText( mPhoneNumber.number() );
mTypeList = KABC::PhoneNumber::typeList();
@@ -723,9 +729,9 @@ KABC::PhoneNumber PhoneTypeDialog::phoneNumber()
else
mPhoneNumber.setType( type & ~KABC::PhoneNumber::Pref );
return mPhoneNumber;
}
#endif
-#ifndef KAB_EMBEDDED
-#include "phoneeditwidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_phoneeditwidget.cpp"
#endif //KAB_EMBEDDED