-rw-r--r-- | kaddressbook/kabcore.cpp | 46 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 2 | ||||
-rw-r--r-- | kaddressbook/kaddressbookmain.cpp | 19 | ||||
-rw-r--r-- | kaddressbook/kaddressbookmain.h | 4 | ||||
-rw-r--r-- | kaddressbook/mainembedded.cpp | 8 |
5 files changed, 41 insertions, 38 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 3e578bc..70ab6b7 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -105,49 +105,49 @@ #include "xxportmanager.h" #include "incsearchwidget.h" #include "jumpbuttonbar.h" #include "extensionmanager.h" #include "addresseeconfig.h" #include <kcmultidialog.h> #ifdef KAB_EMBEDDED KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ mReadWrite( readWrite ), mModified( false ), mMainWindow(client) #else //KAB_EMBEDDED KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), mReadWrite( readWrite ), mModified( false ) #endif //KAB_EMBEDDED { #ifdef KAB_EMBEDDED //US we define here our own global actioncollection. //mActionCollection = new KActionCollection(this); #endif //KAB_EMBEDDED - + mExtensionBarSplitter = 0; mIsPart = !parent->inherits( "KAddressBookMain" ); mAddressBook = KABC::StdAddressBook::self(); KABC::StdAddressBook::setAutomaticSave( true ); #ifndef KAB_EMBEDDED mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); #endif //KAB_EMBEDDED connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), SLOT( addressBookChanged() ) ); mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, "X-Department", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, "X-Profession", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, "X-AssistantsName", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, "X-ManagersName", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, "X-SpousesName", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, "X-Office", "KADDRESSBOOK" ); @@ -202,85 +202,95 @@ KABCore::~KABCore() //saveSettings(); //KABPrefs::instance()->writeConfig(); delete AddresseeConfig::instance(); mAddressBook = 0; KABC::StdAddressBook::close(); #ifdef KAB_EMBEDDED //US we define here our own global actioncollection. // delete mActionCollection; #endif //KAB_EMBEDDED } void KABCore::restoreSettings() { bool state = KABPrefs::instance()->mJumpButtonBarVisible; mActionJumpBar->setChecked( state ); setJumpButtonBarVisible( state ); state = KABPrefs::instance()->mDetailsPageVisible; mActionDetails->setChecked( state ); setDetailsVisible( state ); - QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; + QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; if ( splitterSize.count() == 0 ) { splitterSize.append( width() / 2 ); splitterSize.append( width() / 2 ); } mMiniSplitter->setSizes( splitterSize ); + if ( mExtensionBarSplitter ) { + splitterSize = KABPrefs::instance()->mExtensionsSplitter; + if ( splitterSize.count() == 0 ) { + splitterSize.append( width() / 2 ); + splitterSize.append( width() / 2 ); + } + mExtensionBarSplitter->setSizes( splitterSize ); + + } #ifndef KAB_EMBEDDED QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; if ( splitterSize.count() == 0 ) { splitterSize.append( width() / 2 ); splitterSize.append( width() / 2 ); } mExtensionBarSplitter->setSizes( splitterSize ); splitterSize = KABPrefs::instance()->mDetailsSplitter; if ( splitterSize.count() == 0 ) { splitterSize.append( height() / 2 ); splitterSize.append( height() / 2 ); } mDetailsSplitter->setSizes( splitterSize ); mExtensionManager->restoreSettings(); #endif //KAB_EMBEDDED mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); mViewManager->restoreSettings(); mExtensionManager->restoreSettings(); } void KABCore::saveSettings() { KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); - KABPrefs::instance()->mExtensionsSplitter = mMiniSplitter->sizes(); + if ( mExtensionBarSplitter ) + KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); - + KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); #ifndef KAB_EMBEDDED KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); #endif //KAB_EMBEDDED mExtensionManager->saveSettings(); mViewManager->saveSettings(); KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); } KABC::AddressBook *KABCore::addressBook() const { return mAddressBook; } KConfig *KABCore::config() { #ifndef KAB_EMBEDDED return KABPrefs::instance()->config(); #else //KAB_EMBEDDED return KABPrefs::instance()->getConfig(); #endif //KAB_EMBEDDED @@ -1122,67 +1132,81 @@ void KABCore::initGUI() mXXPortManager = new XXPortManager( this, this ); #else //KAB_EMBEDDED //US initialize viewMenu before settingup viewmanager. // Viewmanager needs this menu to plugin submenues. viewMenu = new QPopupMenu( this ); settingsMenu = new QPopupMenu( this ); //filterMenu = new QPopupMenu( this ); ImportMenu = new QPopupMenu( this ); ExportMenu = new QPopupMenu( this ); //US since we have no splitter for the embedded system, setup // a layout with two frames. One left and one right. QBoxLayout *topLayout; // = new QHBoxLayout( this ); // QBoxLayout *topLayout = (QBoxLayout*)layout(); // QWidget *mainBox = new QWidget( this ); // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); - +#ifdef DESKTOP_VERSION + topLayout = new QHBoxLayout( this ); + + + mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); + mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); + + topLayout->addWidget(mMiniSplitter ); + + mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); + mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); + mViewManager = new ViewManager( this, mExtensionBarSplitter ); + mDetails = new ViewContainer( mMiniSplitter ); + mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); +#else if ( QApplication::desktop()->width() > 480 ) { topLayout = new QHBoxLayout( this ); mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); } else { topLayout = new QVBoxLayout( this ); mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); } topLayout->addWidget(mMiniSplitter ); mViewManager = new ViewManager( this, mMiniSplitter ); mDetails = new ViewContainer( mMiniSplitter ); mExtensionManager = new ExtensionManager( this, mMiniSplitter ); - +#endif //eh->hide(); // topLayout->addWidget(mExtensionManager ); /*US #ifndef KAB_NOSPLITTER QHBoxLayout *topLayout = new QHBoxLayout( this ); //US topLayout->setSpacing( KDialogBase::spacingHint() ); topLayout->setSpacing( 10 ); mDetailsSplitter = new QSplitter( this ); QVBox *viewSpace = new QVBox( mDetailsSplitter ); mViewManager = new ViewManager( this, viewSpace ); viewSpace->setStretchFactor( mViewManager, 1 ); mDetails = new ViewContainer( mDetailsSplitter ); topLayout->addWidget( mDetailsSplitter ); topLayout->setStretchFactor( mDetailsSplitter, 100 ); #else //KAB_NOSPLITTER QHBoxLayout *topLayout = new QHBoxLayout( this ); //US topLayout->setSpacing( KDialogBase::spacingHint() ); @@ -1465,57 +1489,61 @@ void KABCore::addActionsManually() mActionConfigResources->plug( settingsMenu ); settingsMenu->insertSeparator(); mActionConfigKAddressbook->plug( settingsMenu ); if ( mIsPart ) { mActionConfigShortcuts->plug( settingsMenu ); mActionConfigureToolbars->plug( settingsMenu ); } else { mActionKeyBindings->plug( settingsMenu ); } settingsMenu->insertSeparator(); mActionJumpBar->plug( settingsMenu ); mActionDetails->plug( settingsMenu ); settingsMenu->insertSeparator(); mActionWhoAmI->plug( settingsMenu ); mActionCategories->plug( settingsMenu ); mActionAboutKAddressbook->plug( helpMenu ); + if (QApplication::desktop()->width() > 320 ) { mActionEditAddressee->plug( tb ); mActionSave->plug( tb ); mViewManager->getFilterAction()->plug ( tb); - if (QApplication::desktop()->width() > 480 ) - mActionDelete->plug( tb ); + if (QApplication::desktop()->width() > 480 ) { + mActionUndo->plug( tb ); + mActionDelete->plug( tb ); + mActionRedo->plug( tb ); + } } - mActionQuit->plug ( tb ); + //mActionQuit->plug ( tb ); // tb->insertWidget(-1, 0, mIncSearchWidget, 6); //US link the searchwidget first to this. // The real linkage to the toolbar happens later. //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); //US tb->insertItem( mIncSearchWidget ); /*US mIncSearchWidget = new IncSearchWidget( tb ); connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), SLOT( incrementalSearch( const QString& ) ) ); mJumpButtonBar = new JumpButtonBar( this, this ); //US topLayout->addWidget( mJumpButtonBar ); this->layout()->add( mJumpButtonBar ); */ #endif //KAB_EMBEDDED } void KABCore::clipboardDataChanged() { diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index edf98c2..b84ec22 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h @@ -323,49 +323,49 @@ class KABCore : public QWidget void clipboardDataChanged(); void updateActionMenu(); void configureKeyBindings(); #ifdef KAB_EMBEDDED void configureResources(); #endif //KAB_EMBEDDED void slotEditorDestroyed( const QString &uid ); void configurationChanged(); void addressBookChanged(); private: void initGUI(); void initActions(); AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, const char *name = 0 ); KXMLGUIClient *mGUIClient; KABC::AddressBook *mAddressBook; ViewManager *mViewManager; // QSplitter *mDetailsSplitter; - //QSplitter *mExtensionBarSplitter; + KDGanttMinimizeSplitter *mExtensionBarSplitter; ViewContainer *mDetails; KDGanttMinimizeSplitter* mMiniSplitter; XXPortManager *mXXPortManager; JumpButtonBar *mJumpButtonBar; IncSearchWidget *mIncSearchWidget; ExtensionManager *mExtensionManager; KCMultiDialog *mConfigureDialog; #ifndef KAB_EMBEDDED KCMultiDialog *mConfigureDialog; LDAPSearchDialog *mLdapSearchDialog; #endif //KAB_EMBEDDED QDict<AddresseeEditorDialog> mEditorDict; bool mReadWrite; bool mModified; bool mIsPart; //US file menu KAction *mActionMail; KAction* mActionPrint; KAction* mActionNewContact; diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp index 92c32ca..8ebb93a 100644 --- a/kaddressbook/kaddressbookmain.cpp +++ b/kaddressbook/kaddressbookmain.cpp @@ -71,66 +71,49 @@ KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainW //mCore->restoreSettings(); initActions(); setCentralWidget( mCore ); //US statusBar()->show(); #ifndef KAB_EMBEDDED setStandardToolBarMenuEnabled(true); createGUI( "kaddressbookui.rc", false ); #endif //KAB_EMBEDDED setAutoSaveSettings(); qApp->processEvents(); mCore->restoreSettings(); } KAddressBookMain::~KAddressBookMain() { // mCore->saveSettings(); } -#ifndef DESKTOP_VERSION -void KAddressBookMain::show () -{ - static bool block = false; - if( block ) { - QWidget::show(); - return; - } else { - block = true ; - QWidget::showFullScreen(); - } - int min = 20; - if ( QApplication::desktop()->width() > 320 ) - min += 20; - setGeometry( 0,0,QApplication::desktop()->width(), QApplication::desktop()->height() - min ); - block = false; -} -#endif + void KAddressBookMain::showMinimized () { QWidget::showMinimized () ; } void KAddressBookMain::addEmail( QString addr ) { mCore->addEmail( addr ); } #ifndef KAB_EMBEDDED ASYNC KAddressBookMain::showContactEditor( QString uid ) { mCore->editContact( uid ); } #endif //KAB_EMBEDDED void KAddressBookMain::newContact() { mCore->newContact(); } QString KAddressBookMain::getNameByPhone( QString phone ) { return mCore->getNameByPhone( phone ); } diff --git a/kaddressbook/kaddressbookmain.h b/kaddressbook/kaddressbookmain.h index 81ae09c..cf6f899 100644 --- a/kaddressbook/kaddressbookmain.h +++ b/kaddressbook/kaddressbookmain.h @@ -49,52 +49,48 @@ class KConfig; @author Don Sanders <dsanders@kde.org> @version 0.1 */ #ifdef KAB_EMBEDDED class KAddressBookMain : public KMainWindow #else //KAB_EMBEDDED //MOC_SKIP_BEGIN class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface //MOC_SKIP_END #endif //KAB_EMBEDDED { Q_OBJECT public: KAddressBookMain(); virtual ~KAddressBookMain(); #ifdef KAB_EMBEDDED // QPEToolBar * getIconToolBar(); // QToolBar * getIconToolBar(); #endif //KAB_EMBEDDED public slots: -#ifndef DESKTOP_VERSION - void show(); -#endif - void showMinimized () ; virtual void addEmail( QString addr ); #ifndef KAB_EMBEDDED //MOC_SKIP_BEGIN virtual ASYNC showContactEditor( QString uid ); //MOC_SKIP_END #endif //KAB_EMBEDDED virtual void newContact(); virtual QString getNameByPhone( QString phone ); virtual void save(); virtual void exit(); protected: void initActions(); #ifdef KAB_EMBEDDED //US new method to setup menues and toolbars on embedded systems void createGUI(); #endif //KAB_EMBEDDED /** This function is called when it is time for the app to save its properties for session management purposes. */ void saveProperties( KConfig* ); diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index ffa37a5..3f6f69d 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp @@ -47,54 +47,50 @@ int main( int argc, char **argv ) #ifndef _WIN32_ fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons16/"; #else fileName = qApp->applicationDirPath () + "\\kdepim\\kaddressbook\\icons16\\"; #endif KGlobal::iconLoader()->setIconPath(fileName); QString appdir = QDir::homeDirPath(); if ( appdir.right(1) == "\\" || appdir.right(1) == "/" ) appdir += "kaddressbook"; else appdir += "/kaddressbook"; KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); // qDebug(" %s ",KStandardDirs::appDir().latin1() ); #endif // desktop QDir app_dir; if ( !app_dir.exists(KStandardDirs::appDir()) ) app_dir.mkdir (KStandardDirs::appDir()); KAddressBookMain* m = new KAddressBookMain(); //US MainWindow m; //US QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); #ifndef DESKTOP_VERSION a.showMainWidget(m ); - m->showFullScreen(); - int min = 20; - if ( QApplication::desktop()->width() > 320 ) - min += 20; - m->setGeometry( 0,0,QApplication::desktop()->width(), QApplication::desktop()->height() - min ); - + m->showMaximized(); + #else a.setMainWidget(m ); m->show(); //m->resize( 640, 480 ); #endif a.exec(); } qDebug("KA: Bye! "); } /* #include <stdlib.h> #include <qstring.h> #include <kabc/stdaddressbook.h> #include <kaboutdata.h> #include <kcmdlineargs.h> #include <kcrash.h> #include <kdebug.h> #include <klocale.h> #include <kstartupinfo.h> #include <kuniqueapplication.h> |