summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/mainembedded.cpp1
-rw-r--r--kaddressbook/views/contactlistview.cpp6
2 files changed, 4 insertions, 3 deletions
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index cf1fd3e..7f368eb 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -14,96 +14,97 @@
14#include <qdir.h> 14#include <qdir.h>
15#include "kaddressbookmain.h" 15#include "kaddressbookmain.h"
16 16
17int main( int argc, char **argv ) 17int main( int argc, char **argv )
18{ 18{
19#ifndef DESKTOP_VERSION 19#ifndef DESKTOP_VERSION
20 QPEApplication a( argc, argv ); 20 QPEApplication a( argc, argv );
21 a.setKeepRunning (); 21 a.setKeepRunning ();
22#else 22#else
23 QApplication a( argc, argv ); 23 QApplication a( argc, argv );
24 QApplication::setStyle( new QPlatinumStyle ()); 24 QApplication::setStyle( new QPlatinumStyle ());
25#endif 25#endif
26 26
27 bool exitHelp = false; 27 bool exitHelp = false;
28 if ( argc > 1 ) { 28 if ( argc > 1 ) {
29 QString command = argv[1]; 29 QString command = argv[1];
30 if ( command == "-help" ){ 30 if ( command == "-help" ){
31 printf("KA/E command line commands:\n"); 31 printf("KA/E command line commands:\n");
32 printf(" no command: Start KA/E in usual way\n"); 32 printf(" no command: Start KA/E in usual way\n");
33 printf(" -help: This output\n"); 33 printf(" -help: This output\n");
34 printf(" KA/E is exiting now. Bye!\n"); 34 printf(" KA/E is exiting now. Bye!\n");
35 exitHelp = true; 35 exitHelp = true;
36 } 36 }
37 } 37 }
38 if ( ! exitHelp ) { 38 if ( ! exitHelp ) {
39 39
40 KGlobal::setAppName( "kaddressbook" ); 40 KGlobal::setAppName( "kaddressbook" );
41#ifndef DESKTOP_VERSION 41#ifndef DESKTOP_VERSION
42 if ( QApplication::desktop()->width() > 320 ) 42 if ( QApplication::desktop()->width() > 320 )
43 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); 43 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/");
44 else 44 else
45 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); 45 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
46#else 46#else
47 QString fileName ; 47 QString fileName ;
48 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; 48 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/";
49 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 49 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
50 QApplication::addLibraryPath ( qApp->applicationDirPath () ); 50 QApplication::addLibraryPath ( qApp->applicationDirPath () );
51 51
52#endif 52#endif
53 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); 53 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
54 KAddressBookMain m ; 54 KAddressBookMain m ;
55//US MainWindow m; 55//US MainWindow m;
56//US QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); 56//US QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
57 57
58#ifndef DESKTOP_VERSION 58#ifndef DESKTOP_VERSION
59 a.showMainWidget( &m ); 59 a.showMainWidget( &m );
60#else 60#else
61 a.setMainWidget( &m ); 61 a.setMainWidget( &m );
62 m.resize (640, 480 );
62 m.show(); 63 m.show();
63#endif 64#endif
64 a.exec(); 65 a.exec();
65 66
66 } 67 }
67 qDebug("KA: Bye! "); 68 qDebug("KA: Bye! ");
68} 69}
69 70
70/* 71/*
71#include <stdlib.h> 72#include <stdlib.h>
72 73
73#include <qstring.h> 74#include <qstring.h>
74 75
75#include <kabc/stdaddressbook.h> 76#include <kabc/stdaddressbook.h>
76#include <kaboutdata.h> 77#include <kaboutdata.h>
77#include <kcmdlineargs.h> 78#include <kcmdlineargs.h>
78#include <kcrash.h> 79#include <kcrash.h>
79#include <kdebug.h> 80#include <kdebug.h>
80#include <klocale.h> 81#include <klocale.h>
81#include <kstartupinfo.h> 82#include <kstartupinfo.h>
82#include <kuniqueapplication.h> 83#include <kuniqueapplication.h>
83#include <kwin.h> 84#include <kwin.h>
84 85
85#include "kaddressbookmain.h" 86#include "kaddressbookmain.h"
86#include "kabcore.h" 87#include "kabcore.h"
87 88
88extern "C" { 89extern "C" {
89 90
90void crashHandler( int ) 91void crashHandler( int )
91{ 92{
92 KABC::StdAddressBook::handleCrash(); 93 KABC::StdAddressBook::handleCrash();
93 ::exit( 0 ); 94 ::exit( 0 );
94} 95}
95 96
96} 97}
97 98
98class KAddressBookApp : public KUniqueApplication { 99class KAddressBookApp : public KUniqueApplication {
99 public: 100 public:
100 KAddressBookApp() : mMainWin( 0 ) {} 101 KAddressBookApp() : mMainWin( 0 ) {}
101 ~KAddressBookApp() {} 102 ~KAddressBookApp() {}
102 103
103 int newInstance(); 104 int newInstance();
104 105
105 private: 106 private:
106 KAddressBookMain *mMainWin; 107 KAddressBookMain *mMainWin;
107}; 108};
108 109
109int KAddressBookApp::newInstance() 110int KAddressBookApp::newInstance()
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp
index 98b2fb2..9804e28 100644
--- a/kaddressbook/views/contactlistview.cpp
+++ b/kaddressbook/views/contactlistview.cpp
@@ -193,99 +193,99 @@ ContactListView *ContactListViewItem::parent()
193{ 193{
194 return parentListView; 194 return parentListView;
195} 195}
196 196
197 197
198void ContactListViewItem::refresh() 198void ContactListViewItem::refresh()
199{ 199{
200 // Update our addressee, since it may have changed else were 200 // Update our addressee, since it may have changed else were
201 mAddressee = mDocument->findByUid(mAddressee.uid()); 201 mAddressee = mDocument->findByUid(mAddressee.uid());
202 if (mAddressee.isEmpty()) 202 if (mAddressee.isEmpty())
203 return; 203 return;
204 204
205 int i = 0; 205 int i = 0;
206 KABC::Field::List::ConstIterator it; 206 KABC::Field::List::ConstIterator it;
207 for( it = mFields.begin(); it != mFields.end(); ++it ) { 207 for( it = mFields.begin(); it != mFields.end(); ++it ) {
208 setText( i++, (*it)->value( mAddressee ) ); 208 setText( i++, (*it)->value( mAddressee ) );
209 } 209 }
210} 210}
211 211
212/////////////////////////////// 212///////////////////////////////
213// ContactListView 213// ContactListView
214 214
215ContactListView::ContactListView(KAddressBookTableView *view, 215ContactListView::ContactListView(KAddressBookTableView *view,
216 KABC::AddressBook* /* doc */, 216 KABC::AddressBook* /* doc */,
217 QWidget *parent, 217 QWidget *parent,
218 const char *name ) 218 const char *name )
219 : KListView( parent, name ), 219 : KListView( parent, name ),
220 pabWidget( view ), 220 pabWidget( view ),
221 oldColumn( 0 ) 221 oldColumn( 0 )
222{ 222{
223 mABackground = true; 223 mABackground = true;
224 mSingleLine = false; 224 mSingleLine = false;
225 mToolTips = true; 225 mToolTips = true;
226#ifndef KAB_EMBEDDED 226#ifndef KAB_EMBEDDED
227 mAlternateColor = KGlobalSettings::alternateBackgroundColor(); 227 mAlternateColor = KGlobalSettings::alternateBackgroundColor();
228#else //KAB_EMBEDDED 228#else //KAB_EMBEDDED
229 mAlternateColor = QColor(240, 240, 240); 229 mAlternateColor = QColor(240, 240, 240);
230#endif //KAB_EMBEDDED 230#endif //KAB_EMBEDDED
231 231
232 setAlternateBackgroundEnabled(mABackground); 232 setAlternateBackgroundEnabled(mABackground);
233 setAcceptDrops( true ); 233 setAcceptDrops( true );
234 viewport()->setAcceptDrops( true ); 234 viewport()->setAcceptDrops( true );
235 setAllColumnsShowFocus( true ); 235 setAllColumnsShowFocus( true );
236 setShowSortIndicator(true); 236 setShowSortIndicator(true);
237 237
238 setSelectionModeExt( KListView::Extended ); 238 setSelectionModeExt( KListView::Extended );
239 setDropVisualizer(false); 239 setDropVisualizer(false);
240 // setFrameStyle(QFrame::NoFrame); 240 // setFrameStyle(QFrame::NoFrame);
241 setLineWidth ( 0 ); 241 //setLineWidth ( 0 );
242 setMidLineWidth ( 0 ); 242 //setMidLineWidth ( 0 );
243 setMargin ( 0 ); 243 //setMargin ( 0 );
244#ifndef KAB_EMBEDDED 244#ifndef KAB_EMBEDDED
245 connect(this, SIGNAL(dropped(QDropEvent*)), 245 connect(this, SIGNAL(dropped(QDropEvent*)),
246 this, SLOT(itemDropped(QDropEvent*))); 246 this, SLOT(itemDropped(QDropEvent*)));
247#endif //KAB_EMBEDDED 247#endif //KAB_EMBEDDED
248 248
249 249
250 new DynamicTip( this ); 250 new DynamicTip( this );
251} 251}
252 252
253void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) 253void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect )
254{ 254{
255 QBrush b = palette().brush(QPalette::Active, QColorGroup::Base); 255 QBrush b = palette().brush(QPalette::Active, QColorGroup::Base);
256 256
257 // Get the brush, which will have the background pixmap if there is one. 257 // Get the brush, which will have the background pixmap if there is one.
258 if (b.pixmap()) 258 if (b.pixmap())
259 { 259 {
260 p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(), 260 p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(),
261 *(b.pixmap()), 261 *(b.pixmap()),
262 rect.left() + contentsX(), 262 rect.left() + contentsX(),
263 rect.top() + contentsY() ); 263 rect.top() + contentsY() );
264 } 264 }
265 265
266 else 266 else
267 { 267 {
268 // Do a normal paint 268 // Do a normal paint
269 KListView::paintEmptyArea(p, rect); 269 KListView::paintEmptyArea(p, rect);
270 } 270 }
271} 271}
272 272
273void ContactListView::contentsMousePressEvent(QMouseEvent* e) 273void ContactListView::contentsMousePressEvent(QMouseEvent* e)
274{ 274{
275 presspos = e->pos(); 275 presspos = e->pos();
276 KListView::contentsMousePressEvent(e); 276 KListView::contentsMousePressEvent(e);
277} 277}
278 278
279 279
280// To initiate a drag operation 280// To initiate a drag operation
281void ContactListView::contentsMouseMoveEvent( QMouseEvent *e ) 281void ContactListView::contentsMouseMoveEvent( QMouseEvent *e )
282{ 282{
283 if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) { 283 if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) {
284 emit startAddresseeDrag(); 284 emit startAddresseeDrag();
285 } 285 }
286 else 286 else
287 KListView::contentsMouseMoveEvent( e ); 287 KListView::contentsMouseMoveEvent( e );
288} 288}
289 289
290bool ContactListView::acceptDrag(QDropEvent *e) const 290bool ContactListView::acceptDrag(QDropEvent *e) const
291{ 291{