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/kabcore.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | kaddressbook/kabcore.cpp | 146 |
1 files changed, 78 insertions, 68 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index ab2824c..03b44d1 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -39,7 +39,17 @@ $Id$ #include <qlineedit.h> #include <qcheckbox.h> #include <qpushbutton.h> -#include <qprogressbar.h> +#include <q3progressbar.h> +#include <QDesktopWidget> +//Added by qt3to4: +#include <QResizeEvent> +#include <QPixmap> +#include <Q3ValueList> +#include <Q3HBoxLayout> +#include <Q3VBoxLayout> +#include <Q3CString> +#include <Q3PopupMenu> +#include <Q3PtrList> #include <libkdepim/phoneaccess.h> #ifndef KAB_EMBEDDED @@ -47,10 +57,10 @@ $Id$ #include <qdir.h> #include <qfile.h> #include <qapplicaton.h> -#include <qprogressbar.h> +#include <q3progressbar.h> #include <qlayout.h> #include <qregexp.h> -#include <qvbox.h> +#include <q3vbox.h> #include <kabc/addresseelist.h> #include <kabc/errorhandler.h> #include <kabc/resource.h> @@ -88,7 +98,7 @@ $Id$ //US #include <addresseeview.h> -#include <qapp.h> +#include <qapplication.h> #include <qmenubar.h> //#include <qtoolbar.h> #include <qmessagebox.h> @@ -129,12 +139,12 @@ $Id$ #include <qmap.h> #include <qdir.h> #include <qfile.h> -#include <qvbox.h> +#include <q3vbox.h> #include <qlayout.h> #include <qclipboard.h> -#include <qtextstream.h> +#include <q3textstream.h> #include <qradiobutton.h> -#include <qbuttongroup.h> +#include <q3buttongroup.h> #include <libkdepim/categoryselectdialog.h> #include <libkdepim/categoryeditdialog.h> @@ -175,12 +185,12 @@ class KABCatPrefs : public QDialog QDialog( parent, name, true ) { setCaption( i18n("Manage new Categories") ); - QVBoxLayout* lay = new QVBoxLayout( this ); + Q3VBoxLayout* lay = new Q3VBoxLayout( this ); lay->setSpacing( 3 ); lay->setMargin( 3 ); QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); lay->addWidget( lab ); - QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); + Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("New categories not in list:"), this ); lay->addWidget( format ); format->setExclusive ( true ) ; addCatBut = new QRadioButton(i18n("Add to category list"), format ); @@ -207,12 +217,12 @@ class KABFormatPrefs : public QDialog QDialog( parent, name, true ) { setCaption( i18n("Set formatted name") ); - QVBoxLayout* lay = new QVBoxLayout( this ); + Q3VBoxLayout* lay = new Q3VBoxLayout( this ); lay->setSpacing( 3 ); lay->setMargin( 3 ); QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); lay->addWidget( lab ); - QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); + Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Set formatted name to:"), this ); lay->addWidget( format ); format->setExclusive ( true ) ; simple = new QRadioButton(i18n("Simple: James Bond"), format ); @@ -245,29 +255,29 @@ class KAex2phonePrefs : public QDialog QDialog( parent, name, true ) { setCaption( i18n("Export to phone options") ); - QVBoxLayout* lay = new QVBoxLayout( this ); + Q3VBoxLayout* lay = new Q3VBoxLayout( this ); lay->setSpacing( 3 ); lay->setMargin( 3 ); QLabel *lab; lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); - lab->setAlignment (AlignHCenter ); - QHBox* temphb; - temphb = new QHBox( this ); + lab->setAlignment (Qt::AlignHCenter ); + Q3HBox* temphb; + temphb = new Q3HBox( this ); new QLabel( i18n("I/O device: "), temphb ); mPhoneDevice = new QLineEdit( temphb); lay->addWidget( temphb ); - temphb = new QHBox( this ); + temphb = new Q3HBox( this ); new QLabel( i18n("Connection: "), temphb ); mPhoneConnection = new QLineEdit( temphb); lay->addWidget( temphb ); - temphb = new QHBox( this ); + temphb = new Q3HBox( this ); new QLabel( i18n("Model(opt.): "), temphb ); mPhoneModel = new QLineEdit( temphb); lay->addWidget( temphb ); // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); // lay->addWidget( mWriteToSim ); lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); - lab->setAlignment (AlignHCenter); + lab->setAlignment (Qt::AlignHCenter); QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); lay->addWidget( ok ); QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); @@ -407,7 +417,7 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const //QTimer::singleShot( 10, this , SLOT ( updateToolBar())); QTimer::singleShot( 100, this, SLOT ( loadDataAfterStart() )); } -void KABCore::receiveStart( const QCString& cmsg, const QByteArray& data ) +void KABCore::receiveStart( const Q3CString& cmsg, const QByteArray& data ) { //qDebug("KO: QCOP start message received: %s ", cmsg.data() ); mCStringMess = cmsg; @@ -421,9 +431,9 @@ void KABCore::loadDataAfterStart() mViewManager->refreshView(); #ifndef DESKTOP_VERSION - disconnect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT (receiveStart ( const QCString &, const QByteArray & ))); + disconnect(qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), this, SLOT (receiveStart ( const Q3CString &, const QByteArray & ))); - QObject::connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); + QObject::connect(qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const Q3CString &, const QByteArray & ))); if ( !mCStringMess.isEmpty() ) ExternalAppHandler::instance()->appMessage( mCStringMess, mByteData ); #endif @@ -453,11 +463,11 @@ KABCore::~KABCore() delete infrared; #endif } -void KABCore::receive( const QCString& cmsg, const QByteArray& data ) +void KABCore::receive( const Q3CString& cmsg, const QByteArray& data ) { //qDebug("KA: QCOP message received: %s ", cmsg.data() ); if ( cmsg == "setDocument(QString)" ) { - QDataStream stream( data, IO_ReadOnly ); + QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly ); QString fileName; stream >> fileName; recieve( fileName ); @@ -480,7 +490,7 @@ void KABCore::toggleBeamReceive( ) mActionBR->setChecked(true); infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; - QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); + QObject::connect( infrared, SIGNAL (received ( const Q3CString &, const QByteArray & )),this, SLOT(receive( const Q3CString&, const QByteArray& ))); #endif } @@ -560,7 +570,7 @@ void KABCore::restoreSettings() if ( wid < 640 ) wid = QApplication::desktop()->height(); #endif - QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; + Q3ValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; if ( true /*splitterSize.count() == 0*/ ) { splitterSize.append( wid / 2 ); splitterSize.append( wid / 2 ); @@ -650,10 +660,10 @@ QStringList KABCore::selectedUIDs() const KABC::Resource *KABCore::requestResource( QWidget *parent ) { - QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); + Q3PtrList<KABC::Resource> kabcResources = addressBook()->resources(); - QPtrList<KRES::Resource> kresResources; - QPtrListIterator<KABC::Resource> resIt( kabcResources ); + Q3PtrList<KRES::Resource> kresResources; + Q3PtrListIterator<KABC::Resource> resIt( kabcResources ); KABC::Resource *resource; while ( ( resource = resIt.current() ) != 0 ) { ++resIt; @@ -795,14 +805,14 @@ void KABCore::mailVCard( const QStringList& uids ) QFile outFile(fileName); - if ( outFile.open(IO_WriteOnly) ) { // file opened successfully + if ( outFile.open(QIODevice::WriteOnly) ) { // file opened successfully KABC::VCardConverter converter; QString vcard; converter.addresseeToVCard( a, vcard ); - QTextStream t( &outFile ); // use a text stream - t.setEncoding( QTextStream::UnicodeUTF8 ); + Q3TextStream t( &outFile ); // use a text stream + t.setEncoding( Q3TextStream::UnicodeUTF8 ); t << vcard; outFile.close(); @@ -1016,11 +1026,11 @@ void KABCore::beamVCard(const QStringList& uids) } #ifndef DESKTOP_VERSION QFile outFile(fileName); - if ( outFile.open(IO_WriteOnly) ) { + if ( outFile.open(QIODevice::WriteOnly) ) { datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); - QTextStream t( &outFile ); // use a text stream + Q3TextStream t( &outFile ); // use a text stream //t.setEncoding( QTextStream::UnicodeUTF8 ); - t.setEncoding( QTextStream::Latin1 ); + t.setEncoding( Q3TextStream::Latin1 ); t <<datastream.latin1(); outFile.close(); Ir *ir = new Ir( this ); @@ -1297,10 +1307,10 @@ void KABCore::newContact() { - QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); + Q3PtrList<KABC::Resource> kabcResources = mAddressBook->resources(); - QPtrList<KRES::Resource> kresResources; - QPtrListIterator<KABC::Resource> it( kabcResources ); + Q3PtrList<KRES::Resource> kresResources; + Q3PtrListIterator<KABC::Resource> it( kabcResources ); KABC::Resource *resource; while ( ( resource = it.current() ) != 0 ) { ++it; @@ -1856,7 +1866,7 @@ void KABCore::slotEditorDestroyed( const QString &uid ) void KABCore::initGUI() { #ifndef KAB_EMBEDDED - QHBoxLayout *topLayout = new QHBoxLayout( this ); + Q3HBoxLayout *topLayout = new Q3HBoxLayout( this ); topLayout->setSpacing( KDialogBase::spacingHint() ); mExtensionBarSplitter = new QSplitter( this ); @@ -1864,7 +1874,7 @@ void KABCore::initGUI() mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); - QVBox *viewSpace = new QVBox( mDetailsSplitter ); + Q3VBox *viewSpace = new Q3VBox( mDetailsSplitter ); mIncSearchWidget = new IncSearchWidget( viewSpace ); connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), SLOT( incrementalSearch( const QString& ) ) ); @@ -1888,19 +1898,19 @@ void KABCore::initGUI() #else //KAB_EMBEDDED //US initialize viewMenu before settingup viewmanager. // Viewmanager needs this menu to plugin submenues. - viewMenu = new QPopupMenu( this ); - settingsMenu = new QPopupMenu( this ); + viewMenu = new Q3PopupMenu( this ); + settingsMenu = new Q3PopupMenu( this ); //filterMenu = new QPopupMenu( this ); - ImportMenu = new QPopupMenu( this ); - ExportMenu = new QPopupMenu( this ); - syncMenu = new QPopupMenu( this ); - changeMenu= new QPopupMenu( this ); - beamMenu= new QPopupMenu( this ); + ImportMenu = new Q3PopupMenu( this ); + ExportMenu = new Q3PopupMenu( this ); + syncMenu = new Q3PopupMenu( this ); + changeMenu= new Q3PopupMenu( this ); + beamMenu= new Q3PopupMenu( this ); //US since we have no splitter for the embedded system, setup // a layout with two frames. One left and one right. - QBoxLayout *topLayout; + Q3BoxLayout *topLayout; // = new QHBoxLayout( this ); // QBoxLayout *topLayout = (QBoxLayout*)layout(); @@ -1909,7 +1919,7 @@ void KABCore::initGUI() // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); #ifdef DESKTOP_VERSION - topLayout = new QHBoxLayout( this ); + topLayout = new Q3HBoxLayout( this ); mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); @@ -1924,12 +1934,12 @@ void KABCore::initGUI() mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); #else if ( QApplication::desktop()->width() > 480 ) { - topLayout = new QHBoxLayout( this ); + topLayout = new Q3HBoxLayout( this ); mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); } else { - topLayout = new QHBoxLayout( this ); + topLayout = new Q3HBoxLayout( this ); mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); } @@ -2034,17 +2044,17 @@ void KABCore::initActions() mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); - mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, + mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", Qt::CTRL + Qt::Key_P, mViewManager, SLOT( printView() ), actionCollection(), "kaddressbook_print" ); mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); - mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, + mActionSave = new KAction( i18n( "&Save" ), "filesave", Qt::CTRL+Qt::Key_S, this, SLOT( save() ), actionCollection(), "file_sync" ); - mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, + mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", Qt::CTRL+Qt::Key_N, this, SLOT( newContact() ), actionCollection(), "file_new_contact" ); mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, @@ -2083,22 +2093,22 @@ void KABCore::initActions() // edit menu if ( mIsPart ) { - mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, + mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", Qt::CTRL + Qt::Key_C, this, SLOT( copyContacts() ), actionCollection(), "kaddressbook_copy" ); - mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, + mActionCut = new KAction( i18n( "Cu&t" ), "editcut", Qt::CTRL + Qt::Key_X, this, SLOT( cutContacts() ), actionCollection(), "kaddressbook_cut" ); - mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, + mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", Qt::CTRL + Qt::Key_V, this, SLOT( pasteContacts() ), actionCollection(), "kaddressbook_paste" ); - mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, + mActionSelectAll = new KAction( i18n( "Select &All" ), Qt::CTRL + Qt::Key_A, this, SLOT( selectAllContacts() ), actionCollection(), "kaddressbook_select_all" ); - mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, + mActionUndo = new KAction( i18n( "&Undo" ), "undo", Qt::CTRL + Qt::Key_Z, this, SLOT( undo() ), actionCollection(), "kaddressbook_undo" ); - mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, + mActionRedo = new KAction( i18n( "Re&do" ), "redo", Qt::CTRL + Qt::SHIFT + Qt::Key_Z, this, SLOT( redo() ), actionCollection(), "kaddressbook_redo" ); } else { @@ -2111,7 +2121,7 @@ void KABCore::initActions() } mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", - Key_Delete, this, SLOT( deleteContacts() ), + Qt::Key_Delete, this, SLOT( deleteContacts() ), actionCollection(), "edit_delete" ); mActionUndo->setEnabled( false ); @@ -2246,9 +2256,9 @@ void KABCore::addActionsManually() //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); #ifdef KAB_EMBEDDED - QPopupMenu *fileMenu = new QPopupMenu( this ); - QPopupMenu *editMenu = new QPopupMenu( this ); - QPopupMenu *helpMenu = new QPopupMenu( this ); + Q3PopupMenu *fileMenu = new Q3PopupMenu( this ); + Q3PopupMenu *editMenu = new Q3PopupMenu( this ); + Q3PopupMenu *helpMenu = new Q3PopupMenu( this ); KToolBar* tb = mMainWindow->toolBar(); mMainWindow->setToolBarsMovable (false ); @@ -2276,7 +2286,7 @@ void KABCore::addActionsManually() } else { //US setup toolbar QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); - QPopupMenu *popupBarTB = new QPopupMenu( this ); + Q3PopupMenu *popupBarTB = new Q3PopupMenu( this ); menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); tb->insertWidget(-1, 0, menuBarTB); mIncSearchWidget = new IncSearchWidget( tb ); @@ -2631,7 +2641,7 @@ void KABCore::configureKeyBindings() #ifdef KAB_EMBEDDED void KABCore::configureResources() { - KRES::KCMKResources dlg( this, "" , 0 ); + KRES::KCMKResources dlg( this, "" , QStringList() ); if ( !dlg.exec() ) return; @@ -2727,7 +2737,7 @@ void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { ++count; } - QProgressBar bar(count,0 ); + Q3ProgressBar bar(count,0 ); int w = 300; if ( QApplication::desktop()->width() < 320 ) w = 220; @@ -2908,7 +2918,7 @@ KABC::Addressee KABCore::getLastSyncAddressee() sum = "E: "; lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); lse.setRevision( mLastAddressbookSync ); - lse.setCategories( i18n("SyncEvent") ); + lse.setCategories( QStringList(i18n("SyncEvent")) ); mAddressBook->insertAddressee( lse ); } return lse; @@ -3099,7 +3109,7 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); addresseeRSync.setRevision( mLastAddressbookSync ); - addresseeRSync.setCategories( i18n("SyncAddressee") ); + addresseeRSync.setCategories( QStringList(i18n("SyncAddressee")) ); } } if ( addresseeLSync.revision() == mLastAddressbookSync ) { |