summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp46
-rw-r--r--kaddressbook/kabcore.h2
-rw-r--r--kaddressbook/kaddressbookmain.cpp19
-rw-r--r--kaddressbook/kaddressbookmain.h4
-rw-r--r--kaddressbook/mainembedded.cpp8
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
@@ -117,25 +117,25 @@ KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, con
117 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 117 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
118#else //KAB_EMBEDDED 118#else //KAB_EMBEDDED
119KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 119KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
120 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 120 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
121 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 121 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
122 mReadWrite( readWrite ), mModified( false ) 122 mReadWrite( readWrite ), mModified( false )
123#endif //KAB_EMBEDDED 123#endif //KAB_EMBEDDED
124{ 124{
125#ifdef KAB_EMBEDDED 125#ifdef KAB_EMBEDDED
126 //US we define here our own global actioncollection. 126 //US we define here our own global actioncollection.
127 //mActionCollection = new KActionCollection(this); 127 //mActionCollection = new KActionCollection(this);
128#endif //KAB_EMBEDDED 128#endif //KAB_EMBEDDED
129 129 mExtensionBarSplitter = 0;
130 mIsPart = !parent->inherits( "KAddressBookMain" ); 130 mIsPart = !parent->inherits( "KAddressBookMain" );
131 131
132 mAddressBook = KABC::StdAddressBook::self(); 132 mAddressBook = KABC::StdAddressBook::self();
133 KABC::StdAddressBook::setAutomaticSave( true ); 133 KABC::StdAddressBook::setAutomaticSave( true );
134 134
135#ifndef KAB_EMBEDDED 135#ifndef KAB_EMBEDDED
136 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 136 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
137#endif //KAB_EMBEDDED 137#endif //KAB_EMBEDDED
138 138
139 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 139 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
140 SLOT( addressBookChanged() ) ); 140 SLOT( addressBookChanged() ) );
141 141
@@ -214,30 +214,39 @@ KABCore::~KABCore()
214 214
215void KABCore::restoreSettings() 215void KABCore::restoreSettings()
216{ 216{
217 bool state = KABPrefs::instance()->mJumpButtonBarVisible; 217 bool state = KABPrefs::instance()->mJumpButtonBarVisible;
218 218
219 mActionJumpBar->setChecked( state ); 219 mActionJumpBar->setChecked( state );
220 setJumpButtonBarVisible( state ); 220 setJumpButtonBarVisible( state );
221 221
222 state = KABPrefs::instance()->mDetailsPageVisible; 222 state = KABPrefs::instance()->mDetailsPageVisible;
223 223
224 mActionDetails->setChecked( state ); 224 mActionDetails->setChecked( state );
225 setDetailsVisible( state ); 225 setDetailsVisible( state );
226 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; 226 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
227 if ( splitterSize.count() == 0 ) { 227 if ( splitterSize.count() == 0 ) {
228 splitterSize.append( width() / 2 ); 228 splitterSize.append( width() / 2 );
229 splitterSize.append( width() / 2 ); 229 splitterSize.append( width() / 2 );
230 } 230 }
231 mMiniSplitter->setSizes( splitterSize ); 231 mMiniSplitter->setSizes( splitterSize );
232 if ( mExtensionBarSplitter ) {
233 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
234 if ( splitterSize.count() == 0 ) {
235 splitterSize.append( width() / 2 );
236 splitterSize.append( width() / 2 );
237 }
238 mExtensionBarSplitter->setSizes( splitterSize );
239
240 }
232#ifndef KAB_EMBEDDED 241#ifndef KAB_EMBEDDED
233 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; 242 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter;
234 if ( splitterSize.count() == 0 ) { 243 if ( splitterSize.count() == 0 ) {
235 splitterSize.append( width() / 2 ); 244 splitterSize.append( width() / 2 );
236 splitterSize.append( width() / 2 ); 245 splitterSize.append( width() / 2 );
237 } 246 }
238 mExtensionBarSplitter->setSizes( splitterSize ); 247 mExtensionBarSplitter->setSizes( splitterSize );
239 248
240 splitterSize = KABPrefs::instance()->mDetailsSplitter; 249 splitterSize = KABPrefs::instance()->mDetailsSplitter;
241 if ( splitterSize.count() == 0 ) { 250 if ( splitterSize.count() == 0 ) {
242 splitterSize.append( height() / 2 ); 251 splitterSize.append( height() / 2 );
243 splitterSize.append( height() / 2 ); 252 splitterSize.append( height() / 2 );
@@ -248,27 +257,28 @@ void KABCore::restoreSettings()
248 257
249#endif //KAB_EMBEDDED 258#endif //KAB_EMBEDDED
250 259
251 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 260 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
252 261
253 mViewManager->restoreSettings(); 262 mViewManager->restoreSettings();
254 mExtensionManager->restoreSettings(); 263 mExtensionManager->restoreSettings();
255} 264}
256 265
257void KABCore::saveSettings() 266void KABCore::saveSettings()
258{ 267{
259 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 268 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
260 KABPrefs::instance()->mExtensionsSplitter = mMiniSplitter->sizes(); 269 if ( mExtensionBarSplitter )
270 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
261 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 271 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
262 272 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
263#ifndef KAB_EMBEDDED 273#ifndef KAB_EMBEDDED
264 274
265 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 275 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
266 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 276 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
267#endif //KAB_EMBEDDED 277#endif //KAB_EMBEDDED
268 mExtensionManager->saveSettings(); 278 mExtensionManager->saveSettings();
269 mViewManager->saveSettings(); 279 mViewManager->saveSettings();
270 280
271 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 281 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
272 282
273} 283}
274 284
@@ -1134,43 +1144,57 @@ void KABCore::initGUI()
1134 1144
1135//US since we have no splitter for the embedded system, setup 1145//US since we have no splitter for the embedded system, setup
1136// a layout with two frames. One left and one right. 1146// a layout with two frames. One left and one right.
1137 1147
1138 QBoxLayout *topLayout; 1148 QBoxLayout *topLayout;
1139 1149
1140 // = new QHBoxLayout( this ); 1150 // = new QHBoxLayout( this );
1141// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1151// QBoxLayout *topLayout = (QBoxLayout*)layout();
1142 1152
1143// QWidget *mainBox = new QWidget( this ); 1153// QWidget *mainBox = new QWidget( this );
1144// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1154// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1145 1155
1146 1156#ifdef DESKTOP_VERSION
1157 topLayout = new QHBoxLayout( this );
1158
1159
1160 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1161 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1162
1163 topLayout->addWidget(mMiniSplitter );
1164
1165 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1166 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1167 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1168 mDetails = new ViewContainer( mMiniSplitter );
1169 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1170#else
1147 if ( QApplication::desktop()->width() > 480 ) { 1171 if ( QApplication::desktop()->width() > 480 ) {
1148 topLayout = new QHBoxLayout( this ); 1172 topLayout = new QHBoxLayout( this );
1149 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1173 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1150 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1174 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1151 } else { 1175 } else {
1152 1176
1153 topLayout = new QVBoxLayout( this ); 1177 topLayout = new QVBoxLayout( this );
1154 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1178 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1155 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1179 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1156 } 1180 }
1157 1181
1158 topLayout->addWidget(mMiniSplitter ); 1182 topLayout->addWidget(mMiniSplitter );
1159 mViewManager = new ViewManager( this, mMiniSplitter ); 1183 mViewManager = new ViewManager( this, mMiniSplitter );
1160 mDetails = new ViewContainer( mMiniSplitter ); 1184 mDetails = new ViewContainer( mMiniSplitter );
1161 1185
1162 1186
1163 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1187 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1164 1188#endif
1165 //eh->hide(); 1189 //eh->hide();
1166 // topLayout->addWidget(mExtensionManager ); 1190 // topLayout->addWidget(mExtensionManager );
1167 1191
1168 1192
1169/*US 1193/*US
1170#ifndef KAB_NOSPLITTER 1194#ifndef KAB_NOSPLITTER
1171 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1195 QHBoxLayout *topLayout = new QHBoxLayout( this );
1172//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1196//US topLayout->setSpacing( KDialogBase::spacingHint() );
1173 topLayout->setSpacing( 10 ); 1197 topLayout->setSpacing( 10 );
1174 1198
1175 mDetailsSplitter = new QSplitter( this ); 1199 mDetailsSplitter = new QSplitter( this );
1176 1200
@@ -1477,33 +1501,37 @@ void KABCore::addActionsManually()
1477 1501
1478 settingsMenu->insertSeparator(); 1502 settingsMenu->insertSeparator();
1479 1503
1480 mActionJumpBar->plug( settingsMenu ); 1504 mActionJumpBar->plug( settingsMenu );
1481 mActionDetails->plug( settingsMenu ); 1505 mActionDetails->plug( settingsMenu );
1482 settingsMenu->insertSeparator(); 1506 settingsMenu->insertSeparator();
1483 1507
1484 mActionWhoAmI->plug( settingsMenu ); 1508 mActionWhoAmI->plug( settingsMenu );
1485 mActionCategories->plug( settingsMenu ); 1509 mActionCategories->plug( settingsMenu );
1486 1510
1487 mActionAboutKAddressbook->plug( helpMenu ); 1511 mActionAboutKAddressbook->plug( helpMenu );
1488 1512
1513
1489 if (QApplication::desktop()->width() > 320 ) { 1514 if (QApplication::desktop()->width() > 320 ) {
1490 1515
1491 mActionEditAddressee->plug( tb ); 1516 mActionEditAddressee->plug( tb );
1492 mActionSave->plug( tb ); 1517 mActionSave->plug( tb );
1493 mViewManager->getFilterAction()->plug ( tb); 1518 mViewManager->getFilterAction()->plug ( tb);
1494 if (QApplication::desktop()->width() > 480 ) 1519 if (QApplication::desktop()->width() > 480 ) {
1495 mActionDelete->plug( tb ); 1520 mActionUndo->plug( tb );
1521 mActionDelete->plug( tb );
1522 mActionRedo->plug( tb );
1523 }
1496 } 1524 }
1497 mActionQuit->plug ( tb ); 1525 //mActionQuit->plug ( tb );
1498 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 1526 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
1499 1527
1500 //US link the searchwidget first to this. 1528 //US link the searchwidget first to this.
1501 // The real linkage to the toolbar happens later. 1529 // The real linkage to the toolbar happens later.
1502//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 1530//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
1503//US tb->insertItem( mIncSearchWidget ); 1531//US tb->insertItem( mIncSearchWidget );
1504/*US 1532/*US
1505 mIncSearchWidget = new IncSearchWidget( tb ); 1533 mIncSearchWidget = new IncSearchWidget( tb );
1506 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1534 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1507 SLOT( incrementalSearch( const QString& ) ) ); 1535 SLOT( incrementalSearch( const QString& ) ) );
1508 1536
1509 mJumpButtonBar = new JumpButtonBar( this, this ); 1537 mJumpButtonBar = new JumpButtonBar( this, this );
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index edf98c2..b84ec22 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -335,25 +335,25 @@ class KABCore : public QWidget
335 void initGUI(); 335 void initGUI();
336 void initActions(); 336 void initActions();
337 337
338 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 338 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
339 const char *name = 0 ); 339 const char *name = 0 );
340 340
341 KXMLGUIClient *mGUIClient; 341 KXMLGUIClient *mGUIClient;
342 342
343 KABC::AddressBook *mAddressBook; 343 KABC::AddressBook *mAddressBook;
344 344
345 ViewManager *mViewManager; 345 ViewManager *mViewManager;
346 // QSplitter *mDetailsSplitter; 346 // QSplitter *mDetailsSplitter;
347 //QSplitter *mExtensionBarSplitter; 347 KDGanttMinimizeSplitter *mExtensionBarSplitter;
348 ViewContainer *mDetails; 348 ViewContainer *mDetails;
349 KDGanttMinimizeSplitter* mMiniSplitter; 349 KDGanttMinimizeSplitter* mMiniSplitter;
350 XXPortManager *mXXPortManager; 350 XXPortManager *mXXPortManager;
351 JumpButtonBar *mJumpButtonBar; 351 JumpButtonBar *mJumpButtonBar;
352 IncSearchWidget *mIncSearchWidget; 352 IncSearchWidget *mIncSearchWidget;
353 ExtensionManager *mExtensionManager; 353 ExtensionManager *mExtensionManager;
354 354
355 KCMultiDialog *mConfigureDialog; 355 KCMultiDialog *mConfigureDialog;
356 356
357#ifndef KAB_EMBEDDED 357#ifndef KAB_EMBEDDED
358 358
359 KCMultiDialog *mConfigureDialog; 359 KCMultiDialog *mConfigureDialog;
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
index 92c32ca..8ebb93a 100644
--- a/kaddressbook/kaddressbookmain.cpp
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -83,42 +83,25 @@ KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainW
83 83
84 84
85#endif //KAB_EMBEDDED 85#endif //KAB_EMBEDDED
86 setAutoSaveSettings(); 86 setAutoSaveSettings();
87 qApp->processEvents(); 87 qApp->processEvents();
88 mCore->restoreSettings(); 88 mCore->restoreSettings();
89} 89}
90 90
91KAddressBookMain::~KAddressBookMain() 91KAddressBookMain::~KAddressBookMain()
92{ 92{
93 // mCore->saveSettings(); 93 // mCore->saveSettings();
94} 94}
95#ifndef DESKTOP_VERSION 95
96void KAddressBookMain::show ()
97{
98 static bool block = false;
99 if( block ) {
100 QWidget::show();
101 return;
102 } else {
103 block = true ;
104 QWidget::showFullScreen();
105 }
106 int min = 20;
107 if ( QApplication::desktop()->width() > 320 )
108 min += 20;
109 setGeometry( 0,0,QApplication::desktop()->width(), QApplication::desktop()->height() - min );
110 block = false;
111}
112#endif
113void KAddressBookMain::showMinimized () 96void KAddressBookMain::showMinimized ()
114{ 97{
115 QWidget::showMinimized () ; 98 QWidget::showMinimized () ;
116} 99}
117void KAddressBookMain::addEmail( QString addr ) 100void KAddressBookMain::addEmail( QString addr )
118{ 101{
119 mCore->addEmail( addr ); 102 mCore->addEmail( addr );
120} 103}
121 104
122#ifndef KAB_EMBEDDED 105#ifndef KAB_EMBEDDED
123ASYNC KAddressBookMain::showContactEditor( QString uid ) 106ASYNC KAddressBookMain::showContactEditor( QString uid )
124{ 107{
diff --git a/kaddressbook/kaddressbookmain.h b/kaddressbook/kaddressbookmain.h
index 81ae09c..cf6f899 100644
--- a/kaddressbook/kaddressbookmain.h
+++ b/kaddressbook/kaddressbookmain.h
@@ -61,28 +61,24 @@ class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface
61 61
62 public: 62 public:
63 KAddressBookMain(); 63 KAddressBookMain();
64 virtual ~KAddressBookMain(); 64 virtual ~KAddressBookMain();
65 65
66#ifdef KAB_EMBEDDED 66#ifdef KAB_EMBEDDED
67// QPEToolBar * getIconToolBar(); 67// QPEToolBar * getIconToolBar();
68 // QToolBar * getIconToolBar(); 68 // QToolBar * getIconToolBar();
69#endif //KAB_EMBEDDED 69#endif //KAB_EMBEDDED
70 70
71 71
72 public slots: 72 public slots:
73#ifndef DESKTOP_VERSION
74 void show();
75#endif
76
77 void showMinimized () ; 73 void showMinimized () ;
78 virtual void addEmail( QString addr ); 74 virtual void addEmail( QString addr );
79#ifndef KAB_EMBEDDED 75#ifndef KAB_EMBEDDED
80//MOC_SKIP_BEGIN 76//MOC_SKIP_BEGIN
81 virtual ASYNC showContactEditor( QString uid ); 77 virtual ASYNC showContactEditor( QString uid );
82//MOC_SKIP_END 78//MOC_SKIP_END
83#endif //KAB_EMBEDDED 79#endif //KAB_EMBEDDED
84 virtual void newContact(); 80 virtual void newContact();
85 virtual QString getNameByPhone( QString phone ); 81 virtual QString getNameByPhone( QString phone );
86 virtual void save(); 82 virtual void save();
87 virtual void exit(); 83 virtual void exit();
88 84
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index ffa37a5..3f6f69d 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -59,30 +59,26 @@ int main( int argc, char **argv )
59 // qDebug(" %s ",KStandardDirs::appDir().latin1() ); 59 // qDebug(" %s ",KStandardDirs::appDir().latin1() );
60#endif // desktop 60#endif // desktop
61 QDir app_dir; 61 QDir app_dir;
62 if ( !app_dir.exists(KStandardDirs::appDir()) ) 62 if ( !app_dir.exists(KStandardDirs::appDir()) )
63 app_dir.mkdir (KStandardDirs::appDir()); 63 app_dir.mkdir (KStandardDirs::appDir());
64 64
65 KAddressBookMain* m = new KAddressBookMain(); 65 KAddressBookMain* m = new KAddressBookMain();
66//US MainWindow m; 66//US MainWindow m;
67//US QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); 67//US QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
68 68
69#ifndef DESKTOP_VERSION 69#ifndef DESKTOP_VERSION
70 a.showMainWidget(m ); 70 a.showMainWidget(m );
71 m->showFullScreen(); 71 m->showMaximized();
72 int min = 20; 72
73 if ( QApplication::desktop()->width() > 320 )
74 min += 20;
75 m->setGeometry( 0,0,QApplication::desktop()->width(), QApplication::desktop()->height() - min );
76
77#else 73#else
78 a.setMainWidget(m ); 74 a.setMainWidget(m );
79 m->show(); 75 m->show();
80 //m->resize( 640, 480 ); 76 //m->resize( 640, 480 );
81#endif 77#endif
82 a.exec(); 78 a.exec();
83 79
84 } 80 }
85 qDebug("KA: Bye! "); 81 qDebug("KA: Bye! ");
86} 82}
87 83
88/* 84/*