author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kaddressbook/kcmconfigs | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | kaddressbook/kcmconfigs/addresseewidget.cpp | 36 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/addresseewidget.h | 8 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/extensionconfigdialog.cpp | 11 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 59 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.h | 6 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kcmkabconfig.cpp | 8 |
6 files changed, 70 insertions, 58 deletions
diff --git a/kaddressbook/kcmconfigs/addresseewidget.cpp b/kaddressbook/kcmconfigs/addresseewidget.cpp index 168d39e..8055085 100644 --- a/kaddressbook/kcmconfigs/addresseewidget.cpp +++ b/kaddressbook/kcmconfigs/addresseewidget.cpp @@ -1,238 +1,242 @@ /* This file is part of KAddressBook. Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 <qgroupbox.h> +#include <q3groupbox.h> #include <qlabel.h> #include <qlayout.h> -#include <qlistbox.h> +#include <q3listbox.h> #include <qpushbutton.h> #include <qapplication.h> +#include <QDesktopWidget> +//Added by qt3to4: +#include <Q3GridLayout> +#include <Q3HBoxLayout> #include <kbuttonbox.h> #include <kcombobox.h> #include <kconfig.h> #include <kdialog.h> #include <klocale.h> #include <kglobal.h> #include <klineedit.h> #include <kstandarddirs.h> #include "addresseewidget.h" NamePartWidget::NamePartWidget( const QString &title, QWidget *parent, const char *name ) : QWidget( parent, name ) { if (KGlobal::getOrientation() == KGlobal::Portrait) { - QGridLayout* layout = new QGridLayout( this, 1, 1, KDialog::marginHintSmall(), + Q3GridLayout* layout = new Q3GridLayout( this, 1, 1, KDialog::marginHintSmall(), KDialog::spacingHintSmall() ); QLabel *label = new QLabel( i18n( title ), this ); layout->addWidget( label, 0, 1 ); - mBox = new QListBox( this ); + mBox = new Q3ListBox( this ); mBox->setMaximumSize(70, 70); layout->addMultiCellWidget( mBox, 0, 1, 0, 0 ); KButtonBox *bbox = new KButtonBox( this, Qt::Vertical ); mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) ); mRemoveButton = bbox->addButton( i18n( "Rem" ), this, SLOT( remove() ) ); bbox->layout(); layout->addMultiCellWidget( bbox, 0, 1, 2,2); mEdit = new KLineEdit( this ); layout->addWidget( mEdit, 1, 1 ); //mEdit->setMinimumWidth(50); // layout->addWidget( group ); } else { - QHBoxLayout *layout = new QHBoxLayout( this ); + Q3HBoxLayout *layout = new Q3HBoxLayout( this ); - QGroupBox *group = new QGroupBox( 0, Qt::Vertical, title, this ); - QGridLayout *groupLayout = new QGridLayout( group->layout(), 2, 2, + Q3GroupBox *group = new Q3GroupBox( 0, Qt::Vertical, title, this ); + Q3GridLayout *groupLayout = new Q3GridLayout( group->layout(), 2, 2, KDialog::spacingHint() ); - mBox = new QListBox( group ); + mBox = new Q3ListBox( group ); groupLayout->addWidget( mBox, 0, 0 ); KButtonBox *bbox = new KButtonBox( group, Qt::Vertical ); mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) ); mRemoveButton = bbox->addButton( i18n( "Remove" ), this, SLOT( remove() ) ); bbox->layout(); groupLayout->addWidget( bbox, 0, 1 ); mEdit = new KLineEdit( group ); groupLayout->addMultiCellWidget( mEdit, 1, 1, 0, 1 ); layout->addWidget( group ); } mAddButton->setEnabled( false ); mRemoveButton->setEnabled( false ); - connect( mBox, SIGNAL( selectionChanged( QListBoxItem* ) ), - SLOT( selectionChanged( QListBoxItem* ) ) ); + connect( mBox, SIGNAL( selectionChanged( Q3ListBoxItem* ) ), + SLOT( selectionChanged( Q3ListBoxItem* ) ) ); connect( mEdit, SIGNAL( textChanged( const QString& ) ), SLOT( textChanged( const QString& ) ) ); connect( mEdit, SIGNAL( returnPressed() ), SLOT( add() ) ); } NamePartWidget::~NamePartWidget() { } void NamePartWidget::setNameParts( const QStringList &list ) { mBox->clear(); mBox->insertStringList( list ); } QStringList NamePartWidget::nameParts() const { QStringList parts; for ( uint i = 0; i < mBox->count(); ++i ) parts.append( mBox->text( i ) ); return parts; } void NamePartWidget::add() { if ( !mEdit->text().isEmpty() ) { mBox->insertItem( mEdit->text() ); emit modified(); } mEdit->setText( "" ); } void NamePartWidget::remove() { mBox->removeItem( mBox->currentItem() ); if ( mBox->count() == 0 ) selectionChanged( 0 ); emit modified(); } -void NamePartWidget::selectionChanged( QListBoxItem *item ) +void NamePartWidget::selectionChanged( Q3ListBoxItem *item ) { mRemoveButton->setEnabled( item != 0 ); } void NamePartWidget::textChanged( const QString& text ) { mAddButton->setEnabled( !text.isEmpty() ); } AddresseeWidget::AddresseeWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) { - QGridLayout *layout; + Q3GridLayout *layout; mPrefix = new NamePartWidget( i18n( "Prefixes" ), this ); mInclusion = new NamePartWidget( i18n( "Inclusions" ), this ); mSuffix = new NamePartWidget( i18n( "Suffixes" ), this ); QString dfn; if (QApplication::desktop()->width() > 320 ) dfn = i18n( "Default formatted name:" ); else dfn = i18n( "Def. formatted name:" ); QLabel *label = new QLabel( dfn, this ); mFormattedNameCombo = new KComboBox( this ); mFormattedNameCombo->insertItem( i18n( "Empty" ) ); mFormattedNameCombo->insertItem( i18n( "Simple Name" ) ); mFormattedNameCombo->insertItem( i18n( "Full Name" ) ); mFormattedNameCombo->insertItem( i18n( "Reverse Name" ) ); if (KGlobal::getOrientation() == KGlobal::Portrait) { - layout = new QGridLayout( this, 4, 2, KDialog::marginHintSmall(), + layout = new Q3GridLayout( this, 4, 2, KDialog::marginHintSmall(), KDialog::spacingHintSmall() ); layout->addMultiCellWidget( mPrefix, 0, 0, 0, 1 ); layout->addMultiCellWidget( mInclusion, 1, 1, 0, 1 ); layout->addMultiCellWidget( mSuffix, 2, 2, 0, 1 ); layout->addWidget( label, 3, 0 ); layout->addWidget( mFormattedNameCombo, 3, 1 ); } else { - layout = new QGridLayout( this, 2, 3, KDialog::marginHint(), + layout = new Q3GridLayout( this, 2, 3, KDialog::marginHint(), KDialog::spacingHint() ); layout->addWidget( mPrefix, 0, 0 ); layout->addWidget( mInclusion, 0, 1 ); layout->addWidget( mSuffix, 0, 2 ); layout->addWidget( label, 1, 0 ); layout->addMultiCellWidget( mFormattedNameCombo, 1, 1, 1, 2 ); } connect( mPrefix, SIGNAL( modified() ), SIGNAL( modified() ) ); connect( mInclusion, SIGNAL( modified() ), SIGNAL( modified() ) ); connect( mSuffix, SIGNAL( modified() ), SIGNAL( modified() ) ); connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SIGNAL( modified() ) ); } AddresseeWidget::~AddresseeWidget() { } void AddresseeWidget::restoreSettings() { KConfig config( locateLocal("config", "kabcrc") ); config.setGroup( "General" ); mPrefix->setNameParts( config.readListEntry( "Prefixes" ) ); mInclusion->setNameParts( config.readListEntry( "Inclusions" ) ); mSuffix->setNameParts( config.readListEntry( "Suffixes" ) ); mFormattedNameCombo->setCurrentItem( config.readNumEntry( "FormattedNameType", 1 ) ); } void AddresseeWidget::saveSettings() { qDebug("AddresseeWidget::saveSettings() "); KConfig config( locateLocal("config","kabcrc") ); config.setGroup( "General" ); config.writeEntry( "Prefixes", mPrefix->nameParts() ); config.writeEntry( "Inclusions", mInclusion->nameParts() ); config.writeEntry( "Suffixes", mSuffix->nameParts() ); config.writeEntry( "FormattedNameType", mFormattedNameCombo->currentItem() ); } -#ifndef KAB_EMBEDDED -#include "addresseewidget.moc" +#ifndef KAB_EMBEDDED_ +#include "moc_addresseewidget.cpp" #endif //KAB_EMBEDDED diff --git a/kaddressbook/kcmconfigs/addresseewidget.h b/kaddressbook/kcmconfigs/addresseewidget.h index 09330c8..f2a95a8 100644 --- a/kaddressbook/kcmconfigs/addresseewidget.h +++ b/kaddressbook/kcmconfigs/addresseewidget.h @@ -1,87 +1,87 @@ /* This file is part of KAddressBook. Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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. */ #ifndef ADDRESSEEWIDGET_H #define ADDRESSEEWIDGET_H #include <qwidget.h> class KComboBox; class KLineEdit; -class QListBox; -class QListBoxItem; +class Q3ListBox; +class Q3ListBoxItem; class QPushButton; class NamePartWidget : public QWidget { Q_OBJECT public: NamePartWidget( const QString &title, QWidget *parent, const char *name = 0 ); ~NamePartWidget(); void setNameParts( const QStringList &list ); QStringList nameParts() const; signals: void modified(); private slots: void add(); void remove(); - void selectionChanged( QListBoxItem* ); + void selectionChanged( Q3ListBoxItem* ); void textChanged( const QString& ); private: KLineEdit *mEdit; - QListBox *mBox; + Q3ListBox *mBox; QPushButton *mAddButton; QPushButton *mRemoveButton; }; class AddresseeWidget : public QWidget { Q_OBJECT public: AddresseeWidget( QWidget *parent, const char *name = 0 ); ~AddresseeWidget(); void restoreSettings(); void saveSettings(); signals: void modified(); private: KComboBox *mFormattedNameCombo; NamePartWidget *mPrefix; NamePartWidget *mInclusion; NamePartWidget *mSuffix; }; #endif diff --git a/kaddressbook/kcmconfigs/extensionconfigdialog.cpp b/kaddressbook/kcmconfigs/extensionconfigdialog.cpp index e87b000..33b66ad 100644 --- a/kaddressbook/kcmconfigs/extensionconfigdialog.cpp +++ b/kaddressbook/kcmconfigs/extensionconfigdialog.cpp @@ -1,59 +1,62 @@ /* This file is part of KAddressBook. Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 <qlayout.h> +//Added by qt3to4: +#include <Q3GridLayout> +#include <Q3Frame> #include <klocale.h> #include "configurewidget.h" #include "extensionconfigdialog.h" ExtensionConfigDialog::ExtensionConfigDialog( ExtensionFactory *factory, KConfig *config, QWidget *parent, const char *name ) : KDialogBase( Plain, i18n( "Extension Settings" ), Ok | Cancel, Ok, parent, name, true, true ), mWidget( 0 ), mConfig( config ) { - QFrame *page = plainPage(); - QGridLayout *layout = new QGridLayout( page, 1, 1, marginHint(), spacingHint() ); + Q3Frame *page = plainPage(); + Q3GridLayout *layout = new Q3GridLayout( page, 1, 1, marginHint(), spacingHint() ); mWidget = factory->configureWidget( page, "ExtensionConfigWidget" ); layout->addWidget( mWidget, 0, 0 ); mWidget->restoreSettings( mConfig ); } ExtensionConfigDialog::~ExtensionConfigDialog() { } void ExtensionConfigDialog::slotOk() { mWidget->saveSettings( mConfig ); KDialogBase::slotOk(); } -#ifndef KAB_EMBEDDED -#include "extensionconfigdialog.moc" +#ifndef KAB_EMBEDDED_ +#include "moc_extensionconfigdialog.cpp" #endif //KAB_EMBEDDED diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp index 9e4db74..d2b7ef1 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp +++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp @@ -1,424 +1,427 @@ /* This file is part of KAddressBook. Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 <qcheckbox.h> -#include <qframe.h> -#include <qgroupbox.h> +#include <q3frame.h> +#include <q3groupbox.h> #include <qlayout.h> #include <qpushbutton.h> #include <qtabwidget.h> #include <qcombobox.h> #include <qlineedit.h> #include <qlabel.h> #include <qfile.h> -#include <qvbox.h> +#include <q3vbox.h> +//Added by qt3to4: +#include <Q3HBoxLayout> +#include <Q3PtrList> +#include <Q3VBoxLayout> #include <kconfig.h> #include <kdebug.h> #include <kdialog.h> #include <klistview.h> #include <klocale.h> #include <kglobal.h> #include <kmessagebox.h> #include <kstandarddirs.h> #ifndef KAB_EMBEDDED #include <ktrader.h> #else // KAB_EMBEDDED #include <mergewidget.h> #include <distributionlistwidget.h> #endif // KAB_EMBEDDED #include "addresseewidget.h" #include "extensionconfigdialog.h" #include "extensionwidget.h" #include "kabprefs.h" #include "kabconfigwidget.h" #include <kglobalsettings.h> -class ExtensionItem : public QCheckListItem +class ExtensionItem : public Q3CheckListItem { public: #ifndef KAB_EMBEDDED - ExtensionItem( QListView *parent, const QString &text ); + ExtensionItem( Q3ListView *parent, const QString &text ); void setService( const KService::Ptr &ptr ); #else //KAB_EMBEDDED - ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); + ExtensionItem( Q3ListView *parent, const QString &text, const QString &name, const QString &comment ); void setFactory( ExtensionFactory* fac ); #endif //KAB_EMBEDDED bool configWidgetAvailable() const; ExtensionFactory *factory() const; virtual QString text( int column ) const; private: #ifndef KAB_EMBEDDED KService::Ptr mPtr; #else //KAB_EMBEDDED ExtensionFactory* mFactory; QString mName; QString mComment; #endif //KAB_EMBEDDED }; KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) : KPrefsWidget( prefs, parent, name ) { - QVBoxLayout *topLayout = new QVBoxLayout( this, 0, + Q3VBoxLayout *topLayout = new Q3VBoxLayout( this, 0, KDialog::spacingHintSmall() ); QTabWidget *tabWidget = new QTabWidget( this ); topLayout->addWidget( tabWidget ); // General page QWidget *generalPage = new QWidget( this ); - QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), + Q3VBoxLayout *layout = new Q3VBoxLayout( generalPage, KDialog::marginHintSmall(), KDialog::spacingHintSmall() ); QWidget *hBox = new QWidget( generalPage, "qhbox" ); - QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); + Q3HBoxLayout *hboxLayout = new Q3HBoxLayout( hBox); KPrefsWidFont *detailsFont = addWidFont(i18n("phone:123"),i18n("Details view font"), &(KABPrefs::instance()->mDetailsFont),hBox); hboxLayout->addWidget(detailsFont->label()); hboxLayout->addWidget(detailsFont->preview()); hboxLayout->addWidget(detailsFont->button()); hboxLayout->setMargin(KDialog::marginHintSmall() ); hboxLayout->setSpacing(KDialog::spacingHintSmall()); //hBox->setBackgroundColor( black); layout->addWidget( hBox ); //general groupbox QWidget *vBox = new QWidget( generalPage, "qvbox" ); - QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); + Q3VBoxLayout *boxLayout = new Q3VBoxLayout( vBox ); boxLayout->setAlignment( Qt::AlignTop ); boxLayout->setMargin(KDialog::marginHintSmall() ); boxLayout->setSpacing( KDialog::spacingHintSmall() ); mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" ); boxLayout->addWidget( mMenuBarBox ); mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); boxLayout->addWidget( mSearchReturnBox ); mAutoSearchWithWildcardBox = new QCheckBox( i18n( "Search with '*' prefix (wildcard)" ), vBox, "mwildcard" ); boxLayout->addWidget( mAutoSearchWithWildcardBox); mHideSearchOnSwitchBox = new QCheckBox( i18n( "Shrink searchfield in portrait view" ), vBox, "mswitch" ); boxLayout->addWidget( mHideSearchOnSwitchBox ); #ifdef DESKTOP_VERSION mHideSearchOnSwitchBox->hide(); #endif mViewsSingleClickBox = new QCheckBox( i18n( "Show edit dialog on single click" ), vBox, "msingle" ); boxLayout->addWidget( mViewsSingleClickBox ); mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new contacts" ), vBox, "mparse" ); boxLayout->addWidget( mNameParsing ); mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); boxLayout->addWidget( mMultipleViewsAtOnce ); mAskForDelete = new QCheckBox( i18n( "Ask before delete contact" ), vBox, "mdel" ); boxLayout->addWidget( mAskForDelete ); mAskForQuit = new QCheckBox( i18n( "Show exit confirmation" ), vBox, "mquit" ); boxLayout->addWidget( mAskForQuit ); layout->addWidget( vBox ); tabWidget->addTab( generalPage, i18n( "General" ) ); // Extension page QWidget *extensionPage = new QWidget( this ); - QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), + Q3VBoxLayout *extensionLayout = new Q3VBoxLayout( extensionPage, KDialog::marginHintSmall(), KDialog::spacingHintSmall() ); //extensions groupbox - QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); - boxLayout = new QVBoxLayout( groupBox->layout() ); + Q3GroupBox* groupBox = new Q3GroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); + boxLayout = new Q3VBoxLayout( groupBox->layout() ); boxLayout->setAlignment( Qt::AlignTop ); boxLayout->setMargin(KDialog::marginHintSmall()); boxLayout->setSpacing(KDialog::spacingHintSmall()); groupBox->layout()->setMargin(1) ; groupBox->layout()->setSpacing(0); mExtensionView = new KListView( groupBox ); mExtensionView->setAllColumnsShowFocus( true ); mExtensionView->addColumn( i18n( "Name" ) ); mExtensionView->addColumn( i18n( "Description" ) ); //mExtensionView->setMaximumHeight(80); boxLayout->addWidget( mExtensionView ); mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); mConfigureButton->setEnabled( false ); boxLayout->addWidget( mConfigureButton ); extensionLayout->addWidget( groupBox ); connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); connect( mAskForDelete, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); - connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), - SLOT( selectionChanged( QListViewItem* ) ) ); - connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), - SLOT( itemClicked( QListViewItem* ) ) ); + connect( mExtensionView, SIGNAL( selectionChanged( Q3ListViewItem* ) ), + SLOT( selectionChanged( Q3ListViewItem* ) ) ); + connect( mExtensionView, SIGNAL( clicked( Q3ListViewItem* ) ), + SLOT( itemClicked( Q3ListViewItem* ) ) ); connect( mConfigureButton, SIGNAL( clicked() ), SLOT( configureExtension() ) ); tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); // Addressee page mAddresseeWidget = new AddresseeWidget( this ); tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); } void KABConfigWidget::usrReadConfig() { KABPrefs* prefs = KABPrefs::instance(); bool blocked = signalsBlocked(); blockSignals( true ); mMenuBarBox->setChecked( prefs->mFullMenuBarVisible); mNameParsing->setChecked( prefs->mAutomaticNameParsing ); mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard ); mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch ); mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); mAskForQuit->setChecked( prefs->mAskForQuit ); mAskForDelete->setChecked( prefs->mAskForDelete ); mAddresseeWidget->restoreSettings(); restoreExtensionSettings(); blockSignals( blocked ); } void KABConfigWidget::usrWriteConfig() { KABPrefs* prefs = KABPrefs::instance(); prefs->mFullMenuBarVisible = mMenuBarBox->isChecked(); prefs->mAutomaticNameParsing = mNameParsing->isChecked(); prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); prefs->mAutoSearchWithWildcard = mAutoSearchWithWildcardBox->isChecked(); prefs->mHideSearchOnSwitch = mHideSearchOnSwitchBox->isChecked(); prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); prefs->mAskForQuit = mAskForQuit->isChecked(); prefs->mAskForDelete = mAskForDelete->isChecked(); mAddresseeWidget->saveSettings(); saveExtensionSettings(); } void KABConfigWidget::restoreExtensionSettings() { QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; mExtensionView->clear(); #ifndef KAB_EMBEDDED KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); KTrader::OfferList::ConstIterator it; for ( it = plugins.begin(); it != plugins.end(); ++it ) { if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) continue; ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); item->setService( *it ); if ( activeExtensions.contains( item->factory()->identifier() ) ) item->setOn( true ); } #else //KAB_EMBEDDED ExtensionFactory *extensionFactory = new MergeFactory(); ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); item->setFactory( extensionFactory ); if ( activeExtensions.contains( extensionFactory->identifier() ) ) item->setOn( true ); extensionFactory = new DistributionListFactory(); item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); item->setFactory( extensionFactory ); if ( activeExtensions.contains( extensionFactory->identifier() ) ) item->setOn( true ); #endif //KAB_EMBEDDED } void KABConfigWidget::saveExtensionSettings() { QStringList activeExtensions; - QPtrList<QListViewItem> list; - QListViewItemIterator it( mExtensionView ); + Q3PtrList<Q3ListViewItem> list; + Q3ListViewItemIterator it( mExtensionView ); while ( it.current() ) { ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); if ( item ) { if ( item->isOn() ) activeExtensions.append( item->factory()->identifier() ); } ++it; } KABPrefs::instance()->mActiveExtensions = activeExtensions; } void KABConfigWidget::configureExtension() { ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); if ( !item ) return; #ifndef KAB_EMBEDDED KConfig config( "kaddressbookrc" ); #else //KAB_EMBEDDED KConfig config( locateLocal("config", "kaddressbookrc") ); #endif //KAB_EMBEDDED config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); ExtensionConfigDialog dlg( item->factory(), &config, this ); dlg.exec(); config.sync(); } -void KABConfigWidget::selectionChanged( QListViewItem *i ) +void KABConfigWidget::selectionChanged( Q3ListViewItem *i ) { ExtensionItem *item = static_cast<ExtensionItem*>( i ); if ( !item ) return; mConfigureButton->setEnabled( item->configWidgetAvailable() ); } -void KABConfigWidget::itemClicked( QListViewItem *item ) +void KABConfigWidget::itemClicked( Q3ListViewItem *item ) { if ( item != 0 ) modified(); } #ifndef KAB_EMBEDDED -ExtensionItem::ExtensionItem( QListView *parent, const QString &text ) - : QCheckListItem( parent, text, CheckBox ) +ExtensionItem::ExtensionItem( Q3ListView *parent, const QString &text ) + : Q3CheckListItem( parent, text, CheckBox ) { } void ExtensionItem::setService( const KService::Ptr &ptr ) { mPtr = ptr; } #else //KAB_EMBEDDED -ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ) - : QCheckListItem( parent, text, CheckBox ) +ExtensionItem::ExtensionItem( Q3ListView *parent, const QString &text, const QString &name, const QString &comment ) + : Q3CheckListItem( parent, text, CheckBox ) { mName = name; mComment = comment; } void ExtensionItem::setFactory( ExtensionFactory* fac ) { mFactory = fac; } #endif //KAB_EMBEDDED bool ExtensionItem::configWidgetAvailable() const { #ifndef KAB_EMBEDDED KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); if ( !factory ) return false; ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); if ( !extensionFactory ) return false; return extensionFactory->configureWidgetAvailable(); #else //KAB_EMBEDDED return mFactory->configureWidgetAvailable(); #endif //KAB_EMBEDDED } ExtensionFactory *ExtensionItem::factory() const { #ifndef KAB_EMBEDDED KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); if ( !factory ) return 0; return static_cast<ExtensionFactory*>( factory ); #else //KAB_EMBEDDED return mFactory; #endif //KAB_EMBEDDED } QString ExtensionItem::text( int column ) const { #ifndef KAB_EMBEDDED if ( column == 0 ) return mPtr->name(); else if ( column == 1 ) return mPtr->comment(); else return QString::null; #else //KAB_EMBEDDED if ( column == 0 ) return mName; else if ( column == 1 ) return mComment; else return QString::null; #endif //KAB_EMBEDDED } -#ifndef KAB_EMBEDDED -#include "kabconfigwidget.moc" +#ifndef KAB_EMBEDDED_ +#include "moc_kabconfigwidget.cpp" #endif //KAB_EMBEDDED - diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h index f2a6b1b..4b6e58c 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.h +++ b/kaddressbook/kcmconfigs/kabconfigwidget.h @@ -1,78 +1,78 @@ /* This file is part of KAddressBook. Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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. */ #ifndef KABCONFIGWIDGET_H #define KABCONFIGWIDGET_H #include <kprefswidget.h> class QCheckBox; -class QListViewItem; +class Q3ListViewItem; class QPushButton; class QComboBox; class QLineEdit; class KListView; class KABPrefs; class AddresseeWidget; class KABConfigWidget : public KPrefsWidget { Q_OBJECT public: KABConfigWidget(KABPrefs *prefs, QWidget *parent, const char *name = 0 ); protected: /** Implement this to read custom configuration widgets. */ virtual void usrReadConfig(); /** Implement this to write custom configuration widgets. */ virtual void usrWriteConfig(); private slots: void configureExtension(); - void selectionChanged( QListViewItem* ); - void itemClicked( QListViewItem* ); + void selectionChanged( Q3ListViewItem* ); + void itemClicked( Q3ListViewItem* ); private: void restoreExtensionSettings(); void saveExtensionSettings(); KListView *mExtensionView; QCheckBox *mSearchReturnBox; QCheckBox *mNameParsing; QCheckBox *mViewsSingleClickBox; QCheckBox *mAutoSearchWithWildcardBox; QCheckBox *mHideSearchOnSwitchBox; QCheckBox *mMultipleViewsAtOnce; QCheckBox *mAskForQuit; QCheckBox *mMenuBarBox; QCheckBox *mAskForDelete; QPushButton *mConfigureButton; AddresseeWidget *mAddresseeWidget; }; #endif diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.cpp b/kaddressbook/kcmconfigs/kcmkabconfig.cpp index cbfedbd..55ffcd8 100644 --- a/kaddressbook/kcmconfigs/kcmkabconfig.cpp +++ b/kaddressbook/kcmconfigs/kcmkabconfig.cpp @@ -1,92 +1,94 @@ /* This file is part of KAddressBook. Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 <qlayout.h> +//Added by qt3to4: +#include <Q3VBoxLayout> #ifndef KAB_EMBEDDED #include <kaboutdata.h> #endif //KAB_EMBEDDED #include <kdebug.h> //#include <klocale.h> //#include <stdlib.h> #include "kabconfigwidget.h" #include "kcmkabconfig.h" #include "kabprefs.h" #include "kprefs.h" extern "C" { KCModule *create_kabconfig( QWidget *parent, const char * ) { return new KCMKabConfig( parent, "kcmkabconfig" ); } } KCMKabConfig::KCMKabConfig( QWidget *parent, const char *name ) : KCModule( KABPrefs::instance(), parent, name ) { //abort(); - QVBoxLayout *layout = new QVBoxLayout( this ); + Q3VBoxLayout *layout = new Q3VBoxLayout( this ); mConfigWidget = new KABConfigWidget( (KABPrefs*)getPreferences(), this, "KABConfigWidget" ); layout->addWidget( mConfigWidget ); layout->setSpacing( 0 ); layout->setMargin( 0 ); connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); } void KCMKabConfig::load() { mConfigWidget->readConfig(); } void KCMKabConfig::save() { mConfigWidget->writeConfig(); } void KCMKabConfig::defaults() { mConfigWidget->setDefaults(); } #ifndef KAB_EMBEDDED const KAboutData* KCMKabConfig::aboutData() const { KAboutData *about = new KAboutData( I18N_NOOP( "kcmkabconfig" ), I18N_NOOP( "KAddressBook Configure Dialog" ), 0, 0, KAboutData::License_GPL, I18N_NOOP( "(c), 2003 Tobias Koenig" ) ); about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" ); return about; } #endif //KAB_EMBEDDED -#ifndef KAB_EMBEDDED -#include "kcmkabconfig.moc" +#ifndef KAB_EMBEDDED_ +#include "moc_kcmkabconfig.cpp" #endif //KAB_EMBEDDED |