summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-16 22:19:12 (UTC)
committer zautrix <zautrix>2005-01-16 22:19:12 (UTC)
commit507b362d42d5eed6277ad17422b6ba61acca636e (patch) (unidiff)
treed3d29451d37649b102c3e171e2927437925f8ce8
parenta704468d5fd02d30cf962c8b2d6815c7e9208e5d (diff)
downloadkdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.zip
kdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.tar.gz
kdepimpi-507b362d42d5eed6277ad17422b6ba61acca636e.tar.bz2
print AB
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseeview.cpp38
-rw-r--r--kabc/addresseeview.h4
-rw-r--r--kaddressbook/details/detailsviewcontainer.cpp4
-rw-r--r--kaddressbook/details/detailsviewcontainer.h1
-rw-r--r--kaddressbook/details/look_basic.h2
-rw-r--r--kaddressbook/details/look_html.cpp10
-rw-r--r--kaddressbook/details/look_html.h8
-rw-r--r--kaddressbook/kabcore.cpp21
-rw-r--r--kaddressbook/kabcore.h1
-rw-r--r--kaddressbook/kaddressbookview.h9
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp2
-rw-r--r--kaddressbook/mainembedded.cpp3
-rw-r--r--kaddressbook/viewmanager.h1
-rw-r--r--kaddressbook/views/contactlistview.cpp27
-rw-r--r--kaddressbook/views/contactlistview.h1
-rw-r--r--kaddressbook/views/kaddressbookcardview.cpp29
-rw-r--r--kaddressbook/views/kaddressbookcardview.h2
-rw-r--r--kaddressbook/views/kaddressbooktableview.cpp2
-rw-r--r--kaddressbook/xxportmanager.cpp2
-rw-r--r--korganizer/koeventviewer.cpp2
-rw-r--r--korganizer/kowhatsnextview.cpp42
-rw-r--r--korganizer/kowhatsnextview.h5
22 files changed, 176 insertions, 40 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index 7a4336b..e85991e 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -27,56 +27,84 @@
27#include <kiconloader.h> 27#include <kiconloader.h>
28#include <klocale.h> 28#include <klocale.h>
29//US #include <kstringhandler.h> 29//US #include <kstringhandler.h>
30#include <qscrollview.h> 30#include <qscrollview.h>
31#include <qregexp.h> 31#include <qregexp.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qvbox.h> 33#include <qvbox.h>
34#include <qlabel.h> 34#include <qlabel.h>
35#include <qwidget.h> 35#include <qwidget.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qapplication.h> 37#include <qapplication.h>
38#include <qpushbutton.h> 38#include <qpushbutton.h>
39#ifdef DESKTOP_VERSION
40#include <qpaintdevicemetrics.h>
41#include <qprinter.h>
42#include <qpainter.h>
43#endif
39 44
40 45
41#include "externalapphandler.h" 46#include "externalapphandler.h"
42#include "addresseeview.h" 47#include <kabc/addresseeview.h>
43 48
44 49
45//US #ifndef DESKTOP_VERSION 50//US #ifndef DESKTOP_VERSION
46//US #include <qtopia/qcopenvelope_qws.h> 51//US #include <qtopia/qcopenvelope_qws.h>
47//US #include <qpe/qpeapplication.h> 52//US #include <qpe/qpeapplication.h>
48//US #endif 53//US #endif
49 54
50//US static int kphoneInstalled = 0; 55//US static int kphoneInstalled = 0;
51 56
52using namespace KPIM; 57using namespace KABC;
53 58
54AddresseeView::AddresseeView( QWidget *parent, const char *name ) 59AddresseeView::AddresseeView( QWidget *parent, const char *name )
55//US : KTextBrowser( parent, name )
56 : QTextBrowser( parent, name ) 60 : QTextBrowser( parent, name )
57 61
58 62
59{ 63{
60//US setWrapPolicy( QTextEdit::AtWordBoundary ); 64//US setWrapPolicy( QTextEdit::AtWordBoundary );
61 setLinkUnderline( false ); 65 setLinkUnderline( false );
62 // setVScrollBarMode( QScrollView::AlwaysOff ); 66 // setVScrollBarMode( QScrollView::AlwaysOff );
63 //setHScrollBarMode( QScrollView::AlwaysOff ); 67 //setHScrollBarMode( QScrollView::AlwaysOff );
64 68
65//US QStyleSheet *sheet = styleSheet(); 69//US QStyleSheet *sheet = styleSheet();
66//US QStyleSheetItem *link = sheet->item( "a" ); 70//US QStyleSheetItem *link = sheet->item( "a" );
67//US link->setColor( KGlobalSettings::linkColor() ); 71//US link->setColor( KGlobalSettings::linkColor() );
68 72
69} 73}
70 74void AddresseeView::printMe()
75{
76#ifdef DESKTOP_VERSION
77 QPrinter printer;
78 if (!printer.setup() )
79 return;
80 QPainter p;
81 p.begin ( &printer );
82 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
83 float dx, dy;
84 int wid = (m.width() * 9)/10;
85 dx = (float) wid/(float)contentsWidth ();
86 dy = (float)(m.height()) / (float)contentsHeight ();
87 float scale;
88 // scale to fit the width or height of the paper
89 if ( dx < dy )
90 scale = dx;
91 else
92 scale = dy;
93 p.translate( m.width()/10,0 );
94 p.scale( scale, scale );
95 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
96 p.end();
97#endif
98}
71void AddresseeView::setSource(const QString& n) 99void AddresseeView::setSource(const QString& n)
72{ 100{
73 //qDebug("********AddresseeView::setSource %s", n.latin1()); 101 //qDebug("********AddresseeView::setSource %s", n.latin1());
74 102
75 if ( n.left( 6 ) == "mailto" ) 103 if ( n.left( 6 ) == "mailto" )
76 ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); 104 ExternalAppHandler::instance()->mailToOneContact( n.mid(7) );
77 else if ( n.left( 7 ) == "phoneto" ) 105 else if ( n.left( 7 ) == "phoneto" )
78 ExternalAppHandler::instance()->callByPhone( n.mid(8) ); 106 ExternalAppHandler::instance()->callByPhone( n.mid(8) );
79 else if ( n.left( 5 ) == "faxto" ) 107 else if ( n.left( 5 ) == "faxto" )
80 ExternalAppHandler::instance()->callByFax( n.mid(6) ); 108 ExternalAppHandler::instance()->callByFax( n.mid(6) );
81 else if ( n.left( 5 ) == "smsto" ) 109 else if ( n.left( 5 ) == "smsto" )
82 ExternalAppHandler::instance()->callBySMS( n.mid(6) ); 110 ExternalAppHandler::instance()->callBySMS( n.mid(6) );
@@ -202,25 +230,25 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
202 //qDebug("AddresseeView::setAddressee has to be verified."); 230 //qDebug("AddresseeView::setAddressee has to be verified.");
203 } 231 }
204 232
205 QString aRole = ""; 233 QString aRole = "";
206 QString aOrga = ""; 234 QString aOrga = "";
207 if ( true /*!mAddressee.role().isEmpty()*/ ) { 235 if ( true /*!mAddressee.role().isEmpty()*/ ) {
208 aRole = "<tr>" 236 aRole = "<tr>"
209 "<td align=\"left\">" + mAddressee.role() + "</td>" 237 "<td align=\"left\">" + mAddressee.role() + "</td>"
210 "</tr>"; 238 "</tr>";
211 } 239 }
212 if ( true /*!mAddressee.organization().isEmpty()*/ ) { 240 if ( true /*!mAddressee.organization().isEmpty()*/ ) {
213 aOrga = "<tr>" 241 aOrga = "<tr>"
214 "<td align=\"left\">" + mAddressee.organization() + "</td>" ; 242 "<td align=\"left\">" + mAddressee.organization() + "</td>"
215 "</tr>"; 243 "</tr>";
216 } 244 }
217 mText = ""; 245 mText = "";
218 QString picString = ""; 246 QString picString = "";
219 KABC::Picture picture = mAddressee.photo(); 247 KABC::Picture picture = mAddressee.photo();
220 bool picAvailintern = false; 248 bool picAvailintern = false;
221 bool picAvailUrl = false; 249 bool picAvailUrl = false;
222 if (! picture.undefined() ) { 250 if (! picture.undefined() ) {
223 picAvailintern = (picture.isIntern() && !picture.data().isNull()); 251 picAvailintern = (picture.isIntern() && !picture.data().isNull());
224 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); 252 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() );
225 } 253 }
226 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { 254 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) {
diff --git a/kabc/addresseeview.h b/kabc/addresseeview.h
index 3800512..e977d8f 100644
--- a/kabc/addresseeview.h
+++ b/kabc/addresseeview.h
@@ -19,43 +19,45 @@
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22#ifndef KPIM_ADDRESSEEVIEW_H 22#ifndef KPIM_ADDRESSEEVIEW_H
23#define KPIM_ADDRESSEEVIEW_H 23#define KPIM_ADDRESSEEVIEW_H
24 24
25#include <kabc/addressee.h> 25#include <kabc/addressee.h>
26#include <kdialogbase.h> 26#include <kdialogbase.h>
27 27
28//US #include <ktextbrowser.h> 28//US #include <ktextbrowser.h>
29#include <qtextbrowser.h> 29#include <qtextbrowser.h>
30 30
31namespace KPIM { 31namespace KABC {
32 32
33//US class AddresseeView : public KTextBrowser 33//US class AddresseeView : public KTextBrowser
34class AddresseeView : public QTextBrowser 34class AddresseeView : public QTextBrowser
35{ 35{
36
36 public: 37 public:
37 AddresseeView( QWidget *parent = 0, const char *name = 0 ); 38 AddresseeView( QWidget *parent = 0, const char *name = 0 );
38 39
39 /** 40 /**
40 Sets the addressee object. The addressee is displayed immediately. 41 Sets the addressee object. The addressee is displayed immediately.
41 42
42 @param addr The addressee object. 43 @param addr The addressee object.
43 */ 44 */
44 void setAddressee( const KABC::Addressee& addr ); 45 void setAddressee( const KABC::Addressee& addr );
45 void setSource(const QString& n); 46 void setSource(const QString& n);
46 /** 47 /**
47 Returns the current addressee object. 48 Returns the current addressee object.
48 */ 49 */
49 //KABC::Addressee addressee() const; 50 //KABC::Addressee addressee() const;
51 void printMe();
50 52
51 private: 53 private:
52 //KABC::Addressee mAddressee; 54 //KABC::Addressee mAddressee;
53 QString mText; 55 QString mText;
54 QString getPhoneNumbers( KABC::PhoneNumber::List phones, bool preferred ); 56 QString getPhoneNumbers( KABC::PhoneNumber::List phones, bool preferred );
55 void addTag(const QString & tag,const QString & text); 57 void addTag(const QString & tag,const QString & text);
56 //class AddresseeViewPrivate; 58 //class AddresseeViewPrivate;
57 //AddresseeViewPrivate *d; 59 //AddresseeViewPrivate *d;
58}; 60};
59class AddresseeChooser : public KDialogBase 61class AddresseeChooser : public KDialogBase
60{ 62{
61 Q_OBJECT 63 Q_OBJECT
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp
index 229cce0..cee5886 100644
--- a/kaddressbook/details/detailsviewcontainer.cpp
+++ b/kaddressbook/details/detailsviewcontainer.cpp
@@ -69,24 +69,28 @@ ViewContainer::ViewContainer( QWidget *parent, const char* name )
69 69
70 registerLooks(); 70 registerLooks();
71 71
72#if 1 72#if 1
73 // Hide detailed view selection combo box, because we currently have 73 // Hide detailed view selection combo box, because we currently have
74 // only one. Reenable it when there are more detailed views. 74 // only one. Reenable it when there are more detailed views.
75 label->hide(); 75 label->hide();
76 mStyleCombo->hide(); 76 mStyleCombo->hide();
77 frameRuler->hide(); 77 frameRuler->hide();
78#endif 78#endif
79} 79}
80 80
81void ViewContainer::printView()
82{
83 mCurrentLook->printView();
84}
81KABBasicLook *ViewContainer::currentLook() 85KABBasicLook *ViewContainer::currentLook()
82{ 86{
83 return mCurrentLook; 87 return mCurrentLook;
84} 88}
85 89
86void ViewContainer::registerLooks() 90void ViewContainer::registerLooks()
87{ 91{
88 mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) ); 92 mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) );
89// mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) ); 93// mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) );
90 mStyleCombo->clear(); 94 mStyleCombo->clear();
91 95
92 for ( uint i = 0; i < mLookFactories.count(); ++i ) 96 for ( uint i = 0; i < mLookFactories.count(); ++i )
diff --git a/kaddressbook/details/detailsviewcontainer.h b/kaddressbook/details/detailsviewcontainer.h
index 667f0cb..9684736 100644
--- a/kaddressbook/details/detailsviewcontainer.h
+++ b/kaddressbook/details/detailsviewcontainer.h
@@ -42,24 +42,25 @@ class ViewContainer : public QWidget
42 Return the look currently selected. If there is none, it 42 Return the look currently selected. If there is none, it
43 returns zero. Do not use this pointer to store a reference 43 returns zero. Do not use this pointer to store a reference
44 to a look, the user might select another one (e.g., create 44 to a look, the user might select another one (e.g., create
45 a new object) at any time. 45 a new object) at any time.
46 */ 46 */
47 KABBasicLook *currentLook(); 47 KABBasicLook *currentLook();
48 /** 48 /**
49 Return the contact currently displayed. 49 Return the contact currently displayed.
50 */ 50 */
51 KABC::Addressee addressee(); 51 KABC::Addressee addressee();
52 52
53 public slots: 53 public slots:
54 void printView();
54 /** 55 /**
55 Set the contact currently displayed. 56 Set the contact currently displayed.
56 */ 57 */
57 void setAddressee( const KABC::Addressee& addressee ); 58 void setAddressee( const KABC::Addressee& addressee );
58 59
59 /** 60 /**
60 Set read-write state. 61 Set read-write state.
61 */ 62 */
62 void setReadOnly( bool state ); 63 void setReadOnly( bool state );
63 64
64 signals: 65 signals:
65 /** 66 /**
diff --git a/kaddressbook/details/look_basic.h b/kaddressbook/details/look_basic.h
index 7e8baff..a65c99c 100644
--- a/kaddressbook/details/look_basic.h
+++ b/kaddressbook/details/look_basic.h
@@ -66,26 +66,28 @@ class KABBasicLook : public QVBox
66 */ 66 */
67 virtual void restoreSettings( KConfig* ); 67 virtual void restoreSettings( KConfig* );
68 68
69 /** 69 /**
70 Save the view settings to the configuration file. 70 Save the view settings to the configuration file.
71 */ 71 */
72 virtual void saveSettings( KConfig* ); 72 virtual void saveSettings( KConfig* );
73 73
74 /** 74 /**
75 Retrieve read-write state. 75 Retrieve read-write state.
76 */ 76 */
77 bool isReadOnly() const; 77 bool isReadOnly() const;
78 void printView(){ emit printMyView();}
78 79
79 signals: 80 signals:
81 void printMyView();
80 /** 82 /**
81 This signal is emitted when the user changed the entry. 83 This signal is emitted when the user changed the entry.
82 */ 84 */
83 void entryChanged(); 85 void entryChanged();
84 86
85 /** 87 /**
86 This signal indicates that the entry needs to be changed 88 This signal indicates that the entry needs to be changed
87 immidiately in the database. This might be due to changes in 89 immidiately in the database. This might be due to changes in
88 values that are available in menus. 90 values that are available in menus.
89 */ 91 */
90 void saveMe(); 92 void saveMe();
91 93
diff --git a/kaddressbook/details/look_html.cpp b/kaddressbook/details/look_html.cpp
index 64987b8..bb30650 100644
--- a/kaddressbook/details/look_html.cpp
+++ b/kaddressbook/details/look_html.cpp
@@ -17,32 +17,40 @@
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <addresseeview.h> 24#include <addresseeview.h>
25 25
26#include "look_html.h" 26#include "look_html.h"
27#include <qscrollview.h> 27#include <qscrollview.h>
28#include "kabprefs.h" 28#include "kabprefs.h"
29#include <kabc/addresseeview.h>
29KABHtmlView::KABHtmlView( QWidget *parent, const char *name ) 30KABHtmlView::KABHtmlView( QWidget *parent, const char *name )
30 : KABBasicLook( parent, name ) 31 : KABBasicLook( parent, name )
31{ 32{
32 mView = new KPIM::AddresseeView( this ); 33 mView = new KABC::AddresseeView( this );
33 mView->setFont( KABPrefs::instance()->mDetailsFont ); 34 mView->setFont( KABPrefs::instance()->mDetailsFont );
35 connect(this, SIGNAL(printMyView()),
36 this , SLOT(printMe()));
34} 37}
35 38
36KABHtmlView::~KABHtmlView() 39KABHtmlView::~KABHtmlView()
37{ 40{
38} 41}
42void KABHtmlView::printMe()
43{
44 mView->printMe();
45
46}
39 47
40void KABHtmlView::setAddressee( const KABC::Addressee &addr ) 48void KABHtmlView::setAddressee( const KABC::Addressee &addr )
41{ 49{
42 mView->setFont( KABPrefs::instance()->mDetailsFont ); 50 mView->setFont( KABPrefs::instance()->mDetailsFont );
43 mView->setAddressee( addr ); 51 mView->setAddressee( addr );
44} 52}
45 53
46#ifndef KAB_EMBEDDED 54#ifndef KAB_EMBEDDED
47#include "look_html.moc" 55#include "look_html.moc"
48#endif //KAB_EMBEDDED 56#endif //KAB_EMBEDDED
diff --git a/kaddressbook/details/look_html.h b/kaddressbook/details/look_html.h
index 68a02d9..57eb56f 100644
--- a/kaddressbook/details/look_html.h
+++ b/kaddressbook/details/look_html.h
@@ -20,48 +20,50 @@
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef LOOK_HTML_H 24#ifndef LOOK_HTML_H
25#define LOOK_HTML_H 25#define LOOK_HTML_H
26 26
27#include <klocale.h> 27#include <klocale.h>
28 28
29#include "look_basic.h" 29#include "look_basic.h"
30 30
31namespace KABC { class Addressee; } 31namespace KABC { class Addressee; }
32namespace KPIM { class AddresseeView; } 32namespace KABC { class AddresseeView; }
33 33
34class KABHtmlView : public KABBasicLook 34class KABHtmlView : public KABBasicLook
35{ 35{
36 Q_OBJECT 36 Q_OBJECT
37 37
38 public: 38 public:
39 /** 39 /**
40 The constructor. 40 The constructor.
41 */ 41 */
42 KABHtmlView( QWidget *parent = 0, const char* name = 0 ); 42 KABHtmlView( QWidget *parent = 0, const char* name = 0 );
43 43
44 /** 44 /**
45 The virtual destructor. 45 The virtual destructor.
46 */ 46 */
47 virtual ~KABHtmlView(); 47 virtual ~KABHtmlView();
48 48
49 /** 49 /**
50 Set the addressee. 50 Set the addressee.
51 */ 51 */
52 void setAddressee( const KABC::Addressee& ); 52 void setAddressee( const KABC::Addressee& );
53 public slots:
54 void printMe();
53 55
54 private: 56 private:
55 KPIM::AddresseeView *mView; 57 KABC::AddresseeView *mView;
56}; 58};
57 59
58class KABHtmlViewFactory : public KABLookFactory 60class KABHtmlViewFactory : public KABLookFactory
59{ 61{
60 public: 62 public:
61 KABHtmlViewFactory( QWidget *parent = 0, const char *name = 0 ) 63 KABHtmlViewFactory( QWidget *parent = 0, const char *name = 0 )
62 : KABLookFactory( parent, name ) {} 64 : KABLookFactory( parent, name ) {}
63 65
64 KABBasicLook *create() 66 KABBasicLook *create()
65 { 67 {
66 return new KABHtmlView( mParent, mName ); 68 return new KABHtmlView( mParent, mName );
67 } 69 }
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 4098dda..e61f65f 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1868,36 +1868,33 @@ void KABCore::initGUI()
1868 1868
1869} 1869}
1870void KABCore::initActions() 1870void KABCore::initActions()
1871{ 1871{
1872//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1872//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1873 1873
1874#ifndef KAB_EMBEDDED 1874#ifndef KAB_EMBEDDED
1875 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1875 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1876 SLOT( clipboardDataChanged() ) ); 1876 SLOT( clipboardDataChanged() ) );
1877#endif //KAB_EMBEDDED 1877#endif //KAB_EMBEDDED
1878 1878
1879 // file menu 1879 // file menu
1880 if ( mIsPart ) { 1880
1881 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1882 SLOT( sendMail() ), actionCollection(),
1883 "kaddressbook_mail" );
1884 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1885 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1886
1887 } else {
1888 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1881 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1889 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1882 //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1890 } 1883 mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager,
1884 SLOT( printView() ), actionCollection(), "kaddressbook_print" );
1885
1891 1886
1887 mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails,
1888 SLOT( printView() ), actionCollection(), "kaddressbook_print2" );
1892 1889
1893 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1890 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1894 SLOT( save() ), actionCollection(), "file_sync" ); 1891 SLOT( save() ), actionCollection(), "file_sync" );
1895 1892
1896 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1893 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1897 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1894 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1898 1895
1899 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1896 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1900 this, SLOT( mailVCard() ), 1897 this, SLOT( mailVCard() ),
1901 actionCollection(), "file_mail_vcard"); 1898 actionCollection(), "file_mail_vcard");
1902 1899
1903 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, 1900 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
@@ -2130,24 +2127,26 @@ void KABCore::addActionsManually()
2130 if (QApplication::desktop()->width() > 320 ) { 2127 if (QApplication::desktop()->width() > 320 ) {
2131 // mViewManager->getFilterAction()->plug ( tb); 2128 // mViewManager->getFilterAction()->plug ( tb);
2132 } 2129 }
2133 } 2130 }
2134#endif 2131#endif
2135 // mActionQuit->plug ( mMainWindow->toolBar()); 2132 // mActionQuit->plug ( mMainWindow->toolBar());
2136 2133
2137 2134
2138 2135
2139 //US Now connect the actions with the menue entries. 2136 //US Now connect the actions with the menue entries.
2140#ifdef DESKTOP_VERSION 2137#ifdef DESKTOP_VERSION
2141 mActionPrint->plug( fileMenu ); 2138 mActionPrint->plug( fileMenu );
2139 mActionPrintDetails->plug( fileMenu );
2140 fileMenu->insertSeparator();
2142#endif 2141#endif
2143 mActionMail->plug( fileMenu ); 2142 mActionMail->plug( fileMenu );
2144 fileMenu->insertSeparator(); 2143 fileMenu->insertSeparator();
2145 2144
2146 mActionNewContact->plug( fileMenu ); 2145 mActionNewContact->plug( fileMenu );
2147 mActionNewContact->plug( tb ); 2146 mActionNewContact->plug( tb );
2148 2147
2149 mActionEditAddressee->plug( fileMenu ); 2148 mActionEditAddressee->plug( fileMenu );
2150 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 2149 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
2151 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 2150 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
2152 mActionEditAddressee->plug( tb ); 2151 mActionEditAddressee->plug( tb );
2153 2152
@@ -2759,25 +2758,25 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
2759 else 2758 else
2760 return 2; 2759 return 2;
2761 break; 2760 break;
2762 case SYNC_PREF_ASK: 2761 case SYNC_PREF_ASK:
2763 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 2762 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
2764 if ( lastSync > remoteMod ) 2763 if ( lastSync > remoteMod )
2765 return 1; 2764 return 1;
2766 if ( lastSync > localMod ) 2765 if ( lastSync > localMod )
2767 return 2; 2766 return 2;
2768 localIsNew = localMod >= remoteMod; 2767 localIsNew = localMod >= remoteMod;
2769 //qDebug("conflict! ************************************** "); 2768 //qDebug("conflict! ************************************** ");
2770 { 2769 {
2771 KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); 2770 KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this );
2772 result = acd.executeD(localIsNew); 2771 result = acd.executeD(localIsNew);
2773 return result; 2772 return result;
2774 } 2773 }
2775 break; 2774 break;
2776 case SYNC_PREF_FORCE_LOCAL: 2775 case SYNC_PREF_FORCE_LOCAL:
2777 return 1; 2776 return 1;
2778 break; 2777 break;
2779 case SYNC_PREF_FORCE_REMOTE: 2778 case SYNC_PREF_FORCE_REMOTE:
2780 return 2; 2779 return 2;
2781 break; 2780 break;
2782 2781
2783 default: 2782 default:
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 0d5891e..ecfe6e9 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -421,24 +421,25 @@ class KABCore : public QWidget, public KSyncInterface
421 bool mReadWrite; 421 bool mReadWrite;
422 bool mModified; 422 bool mModified;
423 bool mIsPart; 423 bool mIsPart;
424 bool mMultipleViewsAtOnce; 424 bool mMultipleViewsAtOnce;
425 425
426 426
427 //US file menu 427 //US file menu
428 KAction *mActionMail; 428 KAction *mActionMail;
429 KAction *mActionBeam; 429 KAction *mActionBeam;
430 KToggleAction *mActionBR; 430 KToggleAction *mActionBR;
431 KAction *mActionExport2phone; 431 KAction *mActionExport2phone;
432 KAction* mActionPrint; 432 KAction* mActionPrint;
433 KAction* mActionPrintDetails;
433 KAction* mActionNewContact; 434 KAction* mActionNewContact;
434 KAction *mActionSave; 435 KAction *mActionSave;
435 KAction *mActionEditAddressee; 436 KAction *mActionEditAddressee;
436 KAction *mActionMailVCard; 437 KAction *mActionMailVCard;
437 KAction *mActionBeamVCard; 438 KAction *mActionBeamVCard;
438 439
439 KAction *mActionQuit; 440 KAction *mActionQuit;
440 441
441 //US edit menu 442 //US edit menu
442 KAction *mActionCopy; 443 KAction *mActionCopy;
443 KAction *mActionCut; 444 KAction *mActionCut;
444 KAction *mActionPaste; 445 KAction *mActionPaste;
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h
index 8646136..8f31910 100644
--- a/kaddressbook/kaddressbookview.h
+++ b/kaddressbook/kaddressbookview.h
@@ -29,24 +29,30 @@
29#endif //KAB_EMBEDDED 29#endif //KAB_EMBEDDED
30 30
31class KConfig; 31class KConfig;
32class QDropEvent; 32class QDropEvent;
33 33
34#include <qstringlist.h> 34#include <qstringlist.h>
35#include <kabc/field.h> 35#include <kabc/field.h>
36#include <qwidget.h> 36#include <qwidget.h>
37 37
38#include "viewconfigurewidget.h" 38#include "viewconfigurewidget.h"
39#include "filter.h" 39#include "filter.h"
40 40
41#ifdef DESKTOP_VERSION
42#include <qpaintdevicemetrics.h>
43#include <qprinter.h>
44#include <qpainter.h>
45#endif
46
41namespace KABC { class AddressBook; } 47namespace KABC { class AddressBook; }
42 48
43/** 49/**
44 Base class for all views in kaddressbook. This class implements 50 Base class for all views in kaddressbook. This class implements
45 all the common methods needed to provide a view to the user. 51 all the common methods needed to provide a view to the user.
46 52
47 To implement a specific view (table, card, etc), just inherit from 53 To implement a specific view (table, card, etc), just inherit from
48 this class and implement all the pure virtuals. 54 this class and implement all the pure virtuals.
49 55
50 @author Mike Pilone <mpilone@slac.com> 56 @author Mike Pilone <mpilone@slac.com>
51 */ 57 */
52class KAddressBookView : public QWidget 58class KAddressBookView : public QWidget
@@ -141,24 +147,25 @@ class KAddressBookView : public QWidget
141 DefaultFilterType defaultFilterType() const; 147 DefaultFilterType defaultFilterType() const;
142 148
143 /** 149 /**
144 @return The name of the default filter. This string is 150 @return The name of the default filter. This string is
145 only valid if defaultFilterType() is returning SpecificFilter. 151 only valid if defaultFilterType() is returning SpecificFilter.
146 */ 152 */
147 const QString &defaultFilterName() const; 153 const QString &defaultFilterName() const;
148 154
149 /** 155 /**
150 @return The address book. 156 @return The address book.
151 */ 157 */
152 KABC::AddressBook *addressBook() const; 158 KABC::AddressBook *addressBook() const;
159 void printMyView() { emit printView() ;}
153 160
154 public slots: 161 public slots:
155 /** 162 /**
156 Must be overloaded in subclasses to refresh the view. 163 Must be overloaded in subclasses to refresh the view.
157 Refreshing includes updating the view to ensure that only items 164 Refreshing includes updating the view to ensure that only items
158 in the document are visible. If <i>uid</i> is valid, only the 165 in the document are visible. If <i>uid</i> is valid, only the
159 addressee with uid needs to be refreshed. This is an optimization 166 addressee with uid needs to be refreshed. This is an optimization
160 only. 167 only.
161 */ 168 */
162 virtual void refresh( QString uid = QString::null ) = 0; 169 virtual void refresh( QString uid = QString::null ) = 0;
163 170
164 /** 171 /**
@@ -167,24 +174,26 @@ class KAddressBookView : public QWidget
167 is equal to QString::null, then all addressees should be selected. 174 is equal to QString::null, then all addressees should be selected.
168 */ 175 */
169#ifndef KAB_EMBEDDED 176#ifndef KAB_EMBEDDED
170//MOC_SKIP_BEGIN 177//MOC_SKIP_BEGIN
171 virtual void setSelected( QString uid = QString::null, bool selected = true ) = 0; 178 virtual void setSelected( QString uid = QString::null, bool selected = true ) = 0;
172//MOC_SKIP_END 179//MOC_SKIP_END
173#else //KAB_EMBEDDED 180#else //KAB_EMBEDDED
174 //US my moc can not handle the default parameters. Is this a problem ??? 181 //US my moc can not handle the default parameters. Is this a problem ???
175 virtual void setSelected( QString uid, bool selected) = 0; 182 virtual void setSelected( QString uid, bool selected) = 0;
176#endif //KAB_EMBEDDED 183#endif //KAB_EMBEDDED
177 184
178 signals: 185 signals:
186
187 void printView();
179 /** 188 /**
180 This signal should be emitted by a subclass whenever an addressee 189 This signal should be emitted by a subclass whenever an addressee
181 is modified. 190 is modified.
182 */ 191 */
183 void modified(); 192 void modified();
184 193
185 /** 194 /**
186 This signal should be emitted by a subclass whenever an addressee 195 This signal should be emitted by a subclass whenever an addressee
187 is selected. Selected means that the addressee was given the focus. 196 is selected. Selected means that the addressee was given the focus.
188 Some widgets may call this 'highlighted'. The view is responsible for 197 Some widgets may call this 'highlighted'. The view is responsible for
189 emitting this signal multiple times if multiple items are selected, 198 emitting this signal multiple times if multiple items are selected,
190 with the last item selected being the last emit. 199 with the last item selected being the last emit.
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 8bf9bb0..3ad2f74 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -148,25 +148,25 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *
148 148
149 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); 149 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage );
150 boxLayout = new QVBoxLayout( groupBox->layout() ); 150 boxLayout = new QVBoxLayout( groupBox->layout() );
151 boxLayout->setAlignment( Qt::AlignTop ); 151 boxLayout->setAlignment( Qt::AlignTop );
152 boxLayout->setMargin(KDialog::marginHintSmall()); 152 boxLayout->setMargin(KDialog::marginHintSmall());
153 boxLayout->setSpacing(KDialog::spacingHintSmall()); 153 boxLayout->setSpacing(KDialog::spacingHintSmall());
154 groupBox->layout()->setMargin(1) ; 154 groupBox->layout()->setMargin(1) ;
155 groupBox->layout()->setSpacing(0); 155 groupBox->layout()->setSpacing(0);
156 mExtensionView = new KListView( groupBox ); 156 mExtensionView = new KListView( groupBox );
157 mExtensionView->setAllColumnsShowFocus( true ); 157 mExtensionView->setAllColumnsShowFocus( true );
158 mExtensionView->addColumn( i18n( "Name" ) ); 158 mExtensionView->addColumn( i18n( "Name" ) );
159 mExtensionView->addColumn( i18n( "Description" ) ); 159 mExtensionView->addColumn( i18n( "Description" ) );
160 mExtensionView->setMaximumHeight(80); 160 //mExtensionView->setMaximumHeight(80);
161 161
162 boxLayout->addWidget( mExtensionView ); 162 boxLayout->addWidget( mExtensionView );
163 163
164 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); 164 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
165 mConfigureButton->setEnabled( false ); 165 mConfigureButton->setEnabled( false );
166 boxLayout->addWidget( mConfigureButton ); 166 boxLayout->addWidget( mConfigureButton );
167 167
168 extensionLayout->addWidget( groupBox ); 168 extensionLayout->addWidget( groupBox );
169 169
170 connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 170 connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
171 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 171 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
172 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 172 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 771bec9..1e03dba 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -67,26 +67,27 @@ int main( int argc, char **argv )
67#else 67#else
68 QString fileName ; 68 QString fileName ;
69 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; 69 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/";
70 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 70 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
71 QApplication::addLibraryPath ( qApp->applicationDirPath () ); 71 QApplication::addLibraryPath ( qApp->applicationDirPath () );
72 72
73#endif 73#endif
74 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); 74 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
75 // init language 75 // init language
76 KPimGlobalPrefs::instance()->setGlobalConfig(); 76 KPimGlobalPrefs::instance()->setGlobalConfig();
77 KAddressBookMain m ; 77 KAddressBookMain m ;
78//US MainWindow m; 78//US MainWindow m;
79#ifndef DESKTOP_VERSION
79 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 80 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
80 81#endif
81 82
82 83
83#ifndef DESKTOP_VERSION 84#ifndef DESKTOP_VERSION
84 a.showMainWidget( &m ); 85 a.showMainWidget( &m );
85 86
86#else 87#else
87 a.setMainWidget( &m ); 88 a.setMainWidget( &m );
88 m.resize (640, 480 ); 89 m.resize (640, 480 );
89 m.show(); 90 m.show();
90#endif 91#endif
91 a.exec(); 92 a.exec();
92 93
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h
index 272e1b0..dff9998 100644
--- a/kaddressbook/viewmanager.h
+++ b/kaddressbook/viewmanager.h
@@ -60,24 +60,25 @@ class ViewManager : public QWidget
60 60
61 void unloadViews(); 61 void unloadViews();
62 KSelectAction * getFilterAction() { return mActionSelectFilter; } 62 KSelectAction * getFilterAction() { return mActionSelectFilter; }
63 Filter getFilterByName( const QString &name ) const; 63 Filter getFilterByName( const QString &name ) const;
64 64
65 QStringList selectedUids() const; 65 QStringList selectedUids() const;
66 QStringList selectedEmails() const; 66 QStringList selectedEmails() const;
67 KABC::Addressee::List selectedAddressees() const; 67 KABC::Addressee::List selectedAddressees() const;
68 void setListSelected(QStringList); 68 void setListSelected(QStringList);
69 void setFocusAV(); 69 void setFocusAV();
70 70
71 public slots: 71 public slots:
72 void printView() { if (mActiveView) mActiveView->printMyView() ;}
72 void scrollUP(); 73 void scrollUP();
73 void scrollDOWN(); 74 void scrollDOWN();
74 75
75//US void setSelected( const QString &uid = QString::null, bool selected = true ); 76//US void setSelected( const QString &uid = QString::null, bool selected = true );
76 void setSelected( const QString &uid, bool); 77 void setSelected( const QString &uid, bool);
77//US added another method with no parameter, since my moc compiler does not support default parameters. 78//US added another method with no parameter, since my moc compiler does not support default parameters.
78 void setSelected(); 79 void setSelected();
79 80
80 81
81 82
82//US added another method with no parameter, since my moc compiler does not support default parameters. 83//US added another method with no parameter, since my moc compiler does not support default parameters.
83 void refreshView(); 84 void refreshView();
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp
index 23b091c..e75810e 100644
--- a/kaddressbook/views/contactlistview.cpp
+++ b/kaddressbook/views/contactlistview.cpp
@@ -268,24 +268,51 @@ ContactListView::ContactListView(KAddressBookTableView *view,
268 // setFrameStyle(QFrame::NoFrame); 268 // setFrameStyle(QFrame::NoFrame);
269 //setLineWidth ( 0 ); 269 //setLineWidth ( 0 );
270 //setMidLineWidth ( 0 ); 270 //setMidLineWidth ( 0 );
271 //setMargin ( 0 ); 271 //setMargin ( 0 );
272#ifndef KAB_EMBEDDED 272#ifndef KAB_EMBEDDED
273 connect(this, SIGNAL(dropped(QDropEvent*)), 273 connect(this, SIGNAL(dropped(QDropEvent*)),
274 this, SLOT(itemDropped(QDropEvent*))); 274 this, SLOT(itemDropped(QDropEvent*)));
275#endif //KAB_EMBEDDED 275#endif //KAB_EMBEDDED
276 276
277 277
278 new DynamicTip( this ); 278 new DynamicTip( this );
279} 279}
280void ContactListView::printMe()
281{
282#ifdef DESKTOP_VERSION
283 QPrinter printer;
284 if (!printer.setup() )
285 return;
286 QPainter p;
287 p.begin ( &printer );
288 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
289 float dx, dy;
290 int wid = (m.width() * 9)/10;
291 dx = (float) wid/(float)contentsWidth ();
292 dy = (float)(m.height()) / (float)contentsHeight ();
293 float scale;
294 // scale to fit the width or height of the paper
295 if ( dx < dy )
296 scale = dx;
297 else
298 scale = dy;
299 p.translate( m.width()/10,0 );
300 p.scale( scale, scale );
301 qDebug("scale %f ", scale);
302 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
303 p.end();
304 qDebug("Why does it not print??? ");
305#endif
306}
280 307
281void ContactListView::setAlternateColor(const QColor &m_AlternateColor) 308void ContactListView::setAlternateColor(const QColor &m_AlternateColor)
282{ 309{
283 mAlternateColor = m_AlternateColor; 310 mAlternateColor = m_AlternateColor;
284} 311}
285 312
286void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) 313void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect )
287{ 314{
288 QBrush b = palette().brush(QPalette::Active, QColorGroup::Base); 315 QBrush b = palette().brush(QPalette::Active, QColorGroup::Base);
289 316
290 // Get the brush, which will have the background pixmap if there is one. 317 // Get the brush, which will have the background pixmap if there is one.
291 if (b.pixmap()) 318 if (b.pixmap())
diff --git a/kaddressbook/views/contactlistview.h b/kaddressbook/views/contactlistview.h
index fad7f38..9d1a672 100644
--- a/kaddressbook/views/contactlistview.h
+++ b/kaddressbook/views/contactlistview.h
@@ -96,24 +96,25 @@ protected:
96 * since Qt::FixedPixmap will not scroll with the list view. 96 * since Qt::FixedPixmap will not scroll with the list view.
97 */ 97 */
98 virtual void paintEmptyArea( QPainter * p, const QRect & rect ); 98 virtual void paintEmptyArea( QPainter * p, const QRect & rect );
99 virtual void contentsMousePressEvent(QMouseEvent*); 99 virtual void contentsMousePressEvent(QMouseEvent*);
100 void contentsMouseMoveEvent( QMouseEvent *e ); 100 void contentsMouseMoveEvent( QMouseEvent *e );
101 void contentsDropEvent( QDropEvent *e ); 101 void contentsDropEvent( QDropEvent *e );
102 virtual bool acceptDrag(QDropEvent *e) const; 102 virtual bool acceptDrag(QDropEvent *e) const;
103 103
104protected slots: 104protected slots:
105 void itemDropped(QDropEvent *e); 105 void itemDropped(QDropEvent *e);
106 106
107public slots: 107public slots:
108 void printMe();
108 109
109signals: 110signals:
110 void startAddresseeDrag(); 111 void startAddresseeDrag();
111 void addresseeDropped(QDropEvent *); 112 void addresseeDropped(QDropEvent *);
112 113
113private: 114private:
114 KAddressBookTableView *pabWidget; 115 KAddressBookTableView *pabWidget;
115 int oldColumn; 116 int oldColumn;
116 int column; 117 int column;
117 bool ascending; 118 bool ascending;
118 119
119 bool mABackground; 120 bool mABackground;
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp
index 2d7ed08..107be59 100644
--- a/kaddressbook/views/kaddressbookcardview.cpp
+++ b/kaddressbook/views/kaddressbookcardview.cpp
@@ -29,24 +29,25 @@
29#include <qregexp.h> 29#include <qregexp.h>
30#include <qapplication.h> 30#include <qapplication.h>
31 31
32#include <kabc/addressbook.h> 32#include <kabc/addressbook.h>
33#include <kabc/addressee.h> 33#include <kabc/addressee.h>
34#include <kconfig.h> 34#include <kconfig.h>
35#include <kdebug.h> 35#include <kdebug.h>
36#include <klocale.h> 36#include <klocale.h>
37 37
38#include "kabprefs.h" 38#include "kabprefs.h"
39#include "viewmanager.h" 39#include "viewmanager.h"
40 40
41
41#include "kaddressbookcardview.h" 42#include "kaddressbookcardview.h"
42 43
43#ifndef KAB_EMBEDDED 44#ifndef KAB_EMBEDDED
44extern "C" { 45extern "C" {
45 void *init_libkaddrbk_cardview() 46 void *init_libkaddrbk_cardview()
46 { 47 {
47 return ( new CardViewFactory ); 48 return ( new CardViewFactory );
48 } 49 }
49} 50}
50#endif //KAB_EMBEDDED 51#endif //KAB_EMBEDDED
51 52
52//////////////////////////////// 53////////////////////////////////
@@ -107,24 +108,50 @@ class AddresseeCardViewItem : public CardViewItem
107/////////////////////////////// 108///////////////////////////////
108// AddresseeCardView 109// AddresseeCardView
109 110
110AddresseeCardView::AddresseeCardView(QWidget *parent, const char *name) 111AddresseeCardView::AddresseeCardView(QWidget *parent, const char *name)
111 : CardView(parent, name) 112 : CardView(parent, name)
112{ 113{
113 setAcceptDrops(true); 114 setAcceptDrops(true);
114} 115}
115 116
116AddresseeCardView::~AddresseeCardView() 117AddresseeCardView::~AddresseeCardView()
117{ 118{
118} 119}
120void AddresseeCardView::printMe()
121{
122#ifdef DESKTOP_VERSION
123 QPrinter printer;
124 if (!printer.setup() )
125 return;
126 QPainter p;
127 p.begin ( &printer );
128 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
129 float dx, dy;
130 int wid = (m.width() * 9)/10;
131 dx = (float) wid/(float)contentsWidth ();
132 dy = (float)(m.height()) / (float)contentsHeight ();
133 float scale;
134 // scale to fit the width or height of the paper
135 if ( dx < dy )
136 scale = dx;
137 else
138 scale = dy;
139 p.translate( m.width()/10,0 );
140 p.scale( scale, scale );
141 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
142 p.end();
143 repaint();
144#endif
145}
119 146
120 147
121void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e) 148void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e)
122{ 149{
123#ifndef KAB_EMBEDDED 150#ifndef KAB_EMBEDDED
124 if (QTextDrag::canDecode(e)) 151 if (QTextDrag::canDecode(e))
125 e->accept(); 152 e->accept();
126#else //KAB_EMBEDDED 153#else //KAB_EMBEDDED
127qDebug("AddresseeCardView::dragEnterEvent drag&drop is not implemented"); 154qDebug("AddresseeCardView::dragEnterEvent drag&drop is not implemented");
128#endif //KAB_EMBEDDED 155#endif //KAB_EMBEDDED
129} 156}
130 157
@@ -155,24 +182,26 @@ KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab,
155 mCardView->setSelectionMode(CardView::Extended); 182 mCardView->setSelectionMode(CardView::Extended);
156 layout->addWidget(mCardView); 183 layout->addWidget(mCardView);
157 184
158 // Connect up the signals 185 // Connect up the signals
159 connect(mCardView, SIGNAL(executed(CardViewItem *)), 186 connect(mCardView, SIGNAL(executed(CardViewItem *)),
160 this, SLOT(addresseeExecuted(CardViewItem *))); 187 this, SLOT(addresseeExecuted(CardViewItem *)));
161 connect(mCardView, SIGNAL(selectionChanged()), 188 connect(mCardView, SIGNAL(selectionChanged()),
162 this, SLOT(addresseeSelected())); 189 this, SLOT(addresseeSelected()));
163 connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), 190 connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)),
164 this, SIGNAL(dropped(QDropEvent*))); 191 this, SIGNAL(dropped(QDropEvent*)));
165 connect(mCardView, SIGNAL(startAddresseeDrag()), 192 connect(mCardView, SIGNAL(startAddresseeDrag()),
166 this, SIGNAL(startDrag())); 193 this, SIGNAL(startDrag()));
194 connect(this, SIGNAL(printView()),
195 mCardView , SLOT(printMe()));
167} 196}
168 197
169KAddressBookCardView::~KAddressBookCardView() 198KAddressBookCardView::~KAddressBookCardView()
170{ 199{
171} 200}
172void KAddressBookCardView::setFocusAV() 201void KAddressBookCardView::setFocusAV()
173{ 202{
174 if ( mCardView ) 203 if ( mCardView )
175 mCardView->setFocus(); 204 mCardView->setFocus();
176 205
177} 206}
178void KAddressBookCardView::scrollUP() 207void KAddressBookCardView::scrollUP()
diff --git a/kaddressbook/views/kaddressbookcardview.h b/kaddressbook/views/kaddressbookcardview.h
index 8f22d54..2a71f7e 100644
--- a/kaddressbook/views/kaddressbookcardview.h
+++ b/kaddressbook/views/kaddressbookcardview.h
@@ -76,24 +76,26 @@ class KAddressBookCardView : public KAddressBookView
76 76
77 private: 77 private:
78 AddresseeCardView *mCardView; 78 AddresseeCardView *mCardView;
79 bool mShowEmptyFields; 79 bool mShowEmptyFields;
80}; 80};
81 81
82class AddresseeCardView : public CardView 82class AddresseeCardView : public CardView
83{ 83{
84 Q_OBJECT 84 Q_OBJECT
85 public: 85 public:
86 AddresseeCardView(QWidget *parent, const char *name = 0); 86 AddresseeCardView(QWidget *parent, const char *name = 0);
87 ~AddresseeCardView(); 87 ~AddresseeCardView();
88public slots:
89 void printMe();
88 90
89 signals: 91 signals:
90 void startAddresseeDrag(); 92 void startAddresseeDrag();
91 void addresseeDropped(QDropEvent *); 93 void addresseeDropped(QDropEvent *);
92 94
93 protected: 95 protected:
94 virtual void dragEnterEvent(QDragEnterEvent *); 96 virtual void dragEnterEvent(QDragEnterEvent *);
95 virtual void dropEvent(QDropEvent *); 97 virtual void dropEvent(QDropEvent *);
96 virtual void startDrag(); 98 virtual void startDrag();
97}; 99};
98 100
99 101
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp
index 61703ee..ecd6f05 100644
--- a/kaddressbook/views/kaddressbooktableview.cpp
+++ b/kaddressbook/views/kaddressbooktableview.cpp
@@ -80,24 +80,26 @@ void KAddressBookTableView::reconstructListView()
80 disconnect(mListView, SIGNAL(startAddresseeDrag()), this, 80 disconnect(mListView, SIGNAL(startAddresseeDrag()), this,
81 SIGNAL(startDrag())); 81 SIGNAL(startDrag()));
82 disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), 82 disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)),
83 this, SLOT(addresseeExecuted(QListViewItem*))); 83 this, SLOT(addresseeExecuted(QListViewItem*)));
84 84
85 disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, 85 disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this,
86 SIGNAL(dropped(QDropEvent*))); 86 SIGNAL(dropped(QDropEvent*)));
87 delete mListView; 87 delete mListView;
88 } 88 }
89 89
90 mListView = new ContactListView( this, addressBook(), viewWidget() ); 90 mListView = new ContactListView( this, addressBook(), viewWidget() );
91 91
92 connect(this, SIGNAL(printView()),
93 mListView , SLOT(printMe()));
92 //US set singleClick manually, because it is no global configparameter in embedded space 94 //US set singleClick manually, because it is no global configparameter in embedded space
93 mListView->setSingleClick(KABPrefs::instance()->mHonorSingleClick); 95 mListView->setSingleClick(KABPrefs::instance()->mHonorSingleClick);
94 96
95 // Add the columns 97 // Add the columns
96 KABC::Field::List fieldList = fields(); 98 KABC::Field::List fieldList = fields();
97 KABC::Field::List::ConstIterator it; 99 KABC::Field::List::ConstIterator it;
98 100
99 int c = 0; 101 int c = 0;
100 for( it = fieldList.begin(); it != fieldList.end(); ++it ) { 102 for( it = fieldList.begin(); it != fieldList.end(); ++it ) {
101 mListView->addColumn( (*it)->label() ); 103 mListView->addColumn( (*it)->label() );
102 mListView->setColumnWidthMode(c++, QListView::Manual); 104 mListView->setColumnWidthMode(c++, QListView::Manual);
103//US 105//US
diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp
index 8d40ffe..89a2626 100644
--- a/kaddressbook/xxportmanager.cpp
+++ b/kaddressbook/xxportmanager.cpp
@@ -219,24 +219,24 @@ void XXPortManager::loadPlugins()
219 } 219 }
220} 220}
221 221
222 222
223PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent, 223PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent,
224 const char *name ) 224 const char *name )
225 : KDialogBase( Plain, i18n( "Contact Preview" ), Ok | Cancel, Ok, parent, 225 : KDialogBase( Plain, i18n( "Contact Preview" ), Ok | Cancel, Ok, parent,
226 name, true, true ) 226 name, true, true )
227{ 227{
228 QWidget *page = plainPage(); 228 QWidget *page = plainPage();
229 QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); 229 QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() );
230 230
231 KPIM::AddresseeView *view = new KPIM::AddresseeView( page ); 231 KABC::AddresseeView *view = new KABC::AddresseeView( page );
232 view->setAddressee( addr ); 232 view->setAddressee( addr );
233 233
234 layout->addWidget( view ); 234 layout->addWidget( view );
235 235
236 resize( 400, 300 ); 236 resize( 400, 300 );
237} 237}
238 238
239#ifndef KAB_EMBEDDED 239#ifndef KAB_EMBEDDED
240#include "xxportmanager.moc" 240#include "xxportmanager.moc"
241#endif //KAB_EMBEDDED 241#endif //KAB_EMBEDDED
242 242
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index cee0466..5de667e 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -78,25 +78,25 @@ void KOEventViewer::setSource(const QString& n)
78 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 78 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
79 KABC::AddressBook::Iterator it; 79 KABC::AddressBook::Iterator it;
80 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 80 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
81 // LR I do not understand, why the uid string is different on zaurus and desktop 81 // LR I do not understand, why the uid string is different on zaurus and desktop
82 QString uid = "uid://"+(*it).uid(); 82 QString uid = "uid://"+(*it).uid();
83 83
84 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); 84 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1());
85 if (n == uid ) { 85 if (n == uid ) {
86 //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); 86 //qDebug("found %s ",(*it).mobileHomePhone().latin1() );
87 QDialog dia( this,"dia123", true ); 87 QDialog dia( this,"dia123", true );
88 dia.setCaption( i18n("Details of attendee") ); 88 dia.setCaption( i18n("Details of attendee") );
89 QVBoxLayout lay ( &dia ); 89 QVBoxLayout lay ( &dia );
90 KPIM::AddresseeView av ( &dia ); 90 KABC::AddresseeView av ( &dia );
91 av.setAddressee( (*it) ); 91 av.setAddressee( (*it) );
92 lay.addWidget( &av ); 92 lay.addWidget( &av );
93 if ( QApplication::desktop()->width() < 480 ) 93 if ( QApplication::desktop()->width() < 480 )
94 dia.resize( 220, 240); 94 dia.resize( 220, 240);
95 else { 95 else {
96 dia.resize( 400,400); 96 dia.resize( 400,400);
97 } 97 }
98 dia.exec(); 98 dia.exec();
99 break; 99 break;
100 } 100 }
101 } 101 }
102 return; 102 return;
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 219f7c3..7166a01 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -15,25 +15,27 @@
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qlayout.h> 20#include <qlayout.h>
21#include <qtextbrowser.h> 21#include <qtextbrowser.h>
22#include <qtextcodec.h> 22#include <qtextcodec.h>
23#include <qfileinfo.h> 23#include <qfileinfo.h>
24#include <qlabel.h> 24#include <qlabel.h>
25 25
26#include <qapplication.h> 26#include <qapplication.h>
27 27#ifdef DESKTOP_VERSION
28#include <qpaintdevicemetrics.h>
29#endif
28#include <kglobal.h> 30#include <kglobal.h>
29#include <klocale.h> 31#include <klocale.h>
30#include <kdebug.h> 32#include <kdebug.h>
31#include <kiconloader.h> 33#include <kiconloader.h>
32#include <kmessagebox.h> 34#include <kmessagebox.h>
33 35
34#include <libkcal/calendar.h> 36#include <libkcal/calendar.h>
35 37
36#ifndef KORG_NOPRINTER 38#ifndef KORG_NOPRINTER
37#include "calprinter.h" 39#include "calprinter.h"
38#endif 40#endif
39#include "koglobals.h" 41#include "koglobals.h"
@@ -47,24 +49,49 @@ void WhatsNextTextBrowser::setSource(const QString& n)
47{ 49{
48 50
49 if (n.startsWith("event:")) { 51 if (n.startsWith("event:")) {
50 emit showIncidence(n); 52 emit showIncidence(n);
51 return; 53 return;
52 } else if (n.startsWith("todo:")) { 54 } else if (n.startsWith("todo:")) {
53 emit showIncidence(n); 55 emit showIncidence(n);
54 return; 56 return;
55 } else { 57 } else {
56 QTextBrowser::setSource(n); 58 QTextBrowser::setSource(n);
57 } 59 }
58} 60}
61void WhatsNextTextBrowser::printMe()
62{
63#ifdef DESKTOP_VERSION
64 QPrinter printer;
65 if (!printer.setup() )
66 return;
67 QPainter p;
68 p.begin ( &printer );
69 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
70 float dx, dy;
71 int wid = (m.width() * 9)/10;
72 dx = (float) wid/(float)contentsWidth ();
73 dy = (float)(m.height()) / (float)contentsHeight ();
74 float scale;
75 // scale to fit the width or height of the paper
76 if ( dx < dy )
77 scale = dx;
78 else
79 scale = dy;
80 p.translate( m.width()/10,0 );
81 p.scale( scale, scale );
82 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
83 p.end();
84#endif
85}
59 86
60KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, 87KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
61 const char *name) 88 const char *name)
62 : KOrg::BaseView(calendar, parent, name) 89 : KOrg::BaseView(calendar, parent, name)
63{ 90{
64 // mDateLabel = 91 // mDateLabel =
65 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); 92 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this);
66 // mDateLabel->setMargin(2); 93 // mDateLabel->setMargin(2);
67 // mDateLabel->setAlignment(AlignCenter); 94 // mDateLabel->setAlignment(AlignCenter);
68 setFont( KOPrefs::instance()->mWhatsNextFont ); 95 setFont( KOPrefs::instance()->mWhatsNextFont );
69 mView = new WhatsNextTextBrowser(this); 96 mView = new WhatsNextTextBrowser(this);
70 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); 97 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &)));
@@ -105,36 +132,25 @@ int KOWhatsNextView::currentDateCount()
105} 132}
106 133
107QPtrList<Incidence> KOWhatsNextView::selectedIncidences() 134QPtrList<Incidence> KOWhatsNextView::selectedIncidences()
108{ 135{
109 QPtrList<Incidence> eventList; 136 QPtrList<Incidence> eventList;
110 137
111 return eventList; 138 return eventList;
112} 139}
113 140
114void KOWhatsNextView::printMe() 141void KOWhatsNextView::printMe()
115{ 142{
116#ifdef DESKTOP_VERSION 143#ifdef DESKTOP_VERSION
117 QPrinter printer; 144 mView->printMe();
118 if (!printer.setup() )
119 return;
120 QTextBrowser tb;
121 tb.setFixedSize( 600, 4000 );
122 QPainter::redirect ( tb.viewport(), &printer );
123 updateView();
124 tb.setText( mText );
125 tb.show();
126 tb.repaint();
127 tb.hide();
128 KMessageBox::information( this, i18n("Printing What's Next View!\n\nPlease close after\nprinting is finished."));
129#endif 145#endif
130} 146}
131void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, 147void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd,
132 const QDate &td) 148 const QDate &td)
133{ 149{
134#ifndef KORG_NOPRINTER 150#ifndef KORG_NOPRINTER
135 calPrinter->preview(CalPrinter::Day, fd, td); 151 calPrinter->preview(CalPrinter::Day, fd, td);
136#endif 152#endif
137} 153}
138void KOWhatsNextView::updateConfig() 154void KOWhatsNextView::updateConfig()
139{ 155{
140 setFont( KOPrefs::instance()->mWhatsNextFont ); 156 setFont( KOPrefs::instance()->mWhatsNextFont );
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h
index 0231cf2..715037f 100644
--- a/korganizer/kowhatsnextview.h
+++ b/korganizer/kowhatsnextview.h
@@ -25,27 +25,28 @@
25#include <korganizer/baseview.h> 25#include <korganizer/baseview.h>
26 26
27class QListView; 27class QListView;
28class QLabel; 28class QLabel;
29 29
30class KOEventViewerDialog; 30class KOEventViewerDialog;
31 31
32#include <qpainter.h> 32#include <qpainter.h>
33#include <qwidget.h> 33#include <qwidget.h>
34class WhatsNextTextBrowser : public QTextBrowser { 34class WhatsNextTextBrowser : public QTextBrowser {
35 Q_OBJECT 35 Q_OBJECT
36 public: 36 public:
37 WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {} 37 WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {};
38 38
39 void setSource(const QString &); 39 void setSource(const QString &);
40 void printMe();
40 41
41 signals: 42 signals:
42 void showIncidence(const QString &uid); 43 void showIncidence(const QString &uid);
43}; 44};
44 45
45 46
46/** 47/**
47 This class provides a view of the next events and todos 48 This class provides a view of the next events and todos
48*/ 49*/
49class KOWhatsNextView : public KOrg::BaseView 50class KOWhatsNextView : public KOrg::BaseView
50{ 51{
51 Q_OBJECT 52 Q_OBJECT
@@ -79,21 +80,21 @@ class KOWhatsNextView : public KOrg::BaseView
79 QDate mEventDate; 80 QDate mEventDate;
80 virtual void showEvent ( QShowEvent * ); 81 virtual void showEvent ( QShowEvent * );
81 virtual void hideEvent ( QHideEvent * ); 82 virtual void hideEvent ( QHideEvent * );
82 83
83 private slots: 84 private slots:
84 void showIncidence(const QString &); 85 void showIncidence(const QString &);
85 void restartTimer(); 86 void restartTimer();
86 87
87 88
88 private: 89 private:
89 //void createEventViewer(); 90 //void createEventViewer();
90 QTimer* mTimer; 91 QTimer* mTimer;
91 QTextBrowser *mView; 92 WhatsNextTextBrowser *mView;
92 QString mText; 93 QString mText;
93 // QLabel *mDateLabel; 94 // QLabel *mDateLabel;
94 KOEventViewerDialog *mEventViewer; 95 KOEventViewerDialog *mEventViewer;
95 96
96 QValueList<Incidence *> mTodos; 97 QValueList<Incidence *> mTodos;
97}; 98};
98 99
99#endif 100#endif