-rw-r--r-- | kabc/addresseeview.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index af149a0..0564e85 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp | |||
@@ -45,129 +45,128 @@ | |||
45 | //US #ifndef DESKTOP_VERSION | 45 | //US #ifndef DESKTOP_VERSION |
46 | //US #include <qtopia/qcopenvelope_qws.h> | 46 | //US #include <qtopia/qcopenvelope_qws.h> |
47 | //US #include <qpe/qpeapplication.h> | 47 | //US #include <qpe/qpeapplication.h> |
48 | //US #endif | 48 | //US #endif |
49 | 49 | ||
50 | //US static int kphoneInstalled = 0; | 50 | //US static int kphoneInstalled = 0; |
51 | 51 | ||
52 | using namespace KPIM; | 52 | using namespace KPIM; |
53 | 53 | ||
54 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) | 54 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) |
55 | //US : KTextBrowser( parent, name ) | 55 | //US : KTextBrowser( parent, name ) |
56 | : QTextBrowser( parent, name ) | 56 | : QTextBrowser( parent, name ) |
57 | 57 | ||
58 | 58 | ||
59 | { | 59 | { |
60 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); | 60 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); |
61 | setLinkUnderline( false ); | 61 | setLinkUnderline( false ); |
62 | // setVScrollBarMode( QScrollView::AlwaysOff ); | 62 | // setVScrollBarMode( QScrollView::AlwaysOff ); |
63 | //setHScrollBarMode( QScrollView::AlwaysOff ); | 63 | //setHScrollBarMode( QScrollView::AlwaysOff ); |
64 | 64 | ||
65 | //US QStyleSheet *sheet = styleSheet(); | 65 | //US QStyleSheet *sheet = styleSheet(); |
66 | //US QStyleSheetItem *link = sheet->item( "a" ); | 66 | //US QStyleSheetItem *link = sheet->item( "a" ); |
67 | //US link->setColor( KGlobalSettings::linkColor() ); | 67 | //US link->setColor( KGlobalSettings::linkColor() ); |
68 | 68 | ||
69 | } | 69 | } |
70 | 70 | ||
71 | void AddresseeView::setSource(const QString& n) | 71 | void AddresseeView::setSource(const QString& n) |
72 | { | 72 | { |
73 | //qDebug("********AddresseeView::setSource %s", n.latin1()); | 73 | //qDebug("********AddresseeView::setSource %s", n.latin1()); |
74 | 74 | ||
75 | if ( n.left( 6 ) == "mailto" ) | 75 | if ( n.left( 6 ) == "mailto" ) |
76 | ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); | 76 | ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); |
77 | else if ( n.left( 7 ) == "phoneto" ) | 77 | else if ( n.left( 7 ) == "phoneto" ) |
78 | ExternalAppHandler::instance()->callByPhone( n.mid(8) ); | 78 | ExternalAppHandler::instance()->callByPhone( n.mid(8) ); |
79 | else if ( n.left( 5 ) == "faxto" ) | 79 | else if ( n.left( 5 ) == "faxto" ) |
80 | ExternalAppHandler::instance()->callByFax( n.mid(6) ); | 80 | ExternalAppHandler::instance()->callByFax( n.mid(6) ); |
81 | else if ( n.left( 5 ) == "smsto" ) | 81 | else if ( n.left( 5 ) == "smsto" ) |
82 | ExternalAppHandler::instance()->callBySMS( n.mid(6) ); | 82 | ExternalAppHandler::instance()->callBySMS( n.mid(6) ); |
83 | else if ( n.left( 7 ) == "pagerto" ) | 83 | else if ( n.left( 7 ) == "pagerto" ) |
84 | ExternalAppHandler::instance()->callByPager( n.mid(8) ); | 84 | ExternalAppHandler::instance()->callByPager( n.mid(8) ); |
85 | else if ( n.left( 5 ) == "sipto" ) | 85 | else if ( n.left( 5 ) == "sipto" ) |
86 | ExternalAppHandler::instance()->callBySIP( n.mid(6) ); | 86 | ExternalAppHandler::instance()->callBySIP( n.mid(6) ); |
87 | 87 | ||
88 | } | 88 | } |
89 | void AddresseeView::setAddressee( const KABC::Addressee& addr ) | 89 | void AddresseeView::setAddressee( const KABC::Addressee& addr ) |
90 | { | 90 | { |
91 | ExternalAppHandler* eah = ExternalAppHandler::instance(); | 91 | ExternalAppHandler* eah = ExternalAppHandler::instance(); |
92 | bool kemailAvail = eah->isEmailAppAvailable(); | 92 | bool kemailAvail = eah->isEmailAppAvailable(); |
93 | 93 | ||
94 | 94 | ||
95 | 95 | ||
96 | mAddressee = addr; | 96 | mAddressee = addr; |
97 | // clear view | 97 | // clear view |
98 | setText( QString::null ); | 98 | setText( QString::null ); |
99 | 99 | ||
100 | if ( mAddressee.isEmpty() ) | 100 | if ( mAddressee.isEmpty() ) |
101 | return; | 101 | return; |
102 | 102 | ||
103 | QString name = ( mAddressee.assembledName().isEmpty() ? | 103 | QString name = ( mAddressee.assembledName().isEmpty() ? |
104 | mAddressee.formattedName() : mAddressee.assembledName() ); | 104 | mAddressee.formattedName() : mAddressee.assembledName() ); |
105 | 105 | ||
106 | QString dynamicPart; | 106 | QString dynamicPart; |
107 | 107 | ||
108 | dynamicPart += getPhoneNumbers( true ); | 108 | dynamicPart += getPhoneNumbers( true ); |
109 | qDebug("dynamic preferred %s ",dynamicPart.latin1() ); | ||
110 | QStringList emails = mAddressee.emails(); | 109 | QStringList emails = mAddressee.emails(); |
111 | QStringList::ConstIterator emailIt; | 110 | QStringList::ConstIterator emailIt; |
112 | QString type = i18n( "Email" ); | 111 | QString type = i18n( "Email" ); |
113 | emailIt = emails.begin(); | 112 | emailIt = emails.begin(); |
114 | if ( emailIt != emails.end() ) { | 113 | if ( emailIt != emails.end() ) { |
115 | if ( kemailAvail ) { | 114 | if ( kemailAvail ) { |
116 | dynamicPart += QString( | 115 | dynamicPart += QString( |
117 | "<tr><td align=\"right\"><b>%1</b></td>" | 116 | "<tr><td align=\"right\"><b>%1</b></td>" |
118 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) | 117 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) |
119 | .arg( type ) | 118 | .arg( type ) |
120 | .arg( name ) | 119 | .arg( name ) |
121 | .arg( *emailIt ) | 120 | .arg( *emailIt ) |
122 | .arg( *emailIt ); | 121 | .arg( *emailIt ); |
123 | ++emailIt; | 122 | ++emailIt; |
124 | } else { | 123 | } else { |
125 | dynamicPart += QString( | 124 | dynamicPart += QString( |
126 | "<tr><td align=\"right\"><b>%1</b></td>" | 125 | "<tr><td align=\"right\"><b>%1</b></td>" |
127 | "<td align=\"left\">%2</td></tr>" ) | 126 | "<td align=\"left\">%2</td></tr>" ) |
128 | .arg( type ) | 127 | .arg( type ) |
129 | .arg( *emailIt ); | 128 | .arg( *emailIt ); |
130 | ++emailIt; | 129 | ++emailIt; |
131 | } | 130 | } |
132 | } | 131 | } |
133 | if ( mAddressee.birthday().date().isValid() ) { | 132 | if ( mAddressee.birthday().date().isValid() ) { |
134 | dynamicPart += QString( | 133 | dynamicPart += QString( |
135 | "<tr><td align=\"right\"><b>%1</b></td>" | 134 | "<tr><td align=\"right\"><b>%1</b></td>" |
136 | "<td align=\"left\">%2</td></tr>" ) | 135 | "<td align=\"left\">%2</td></tr>" ) |
137 | .arg( i18n ("Birthday") ) | 136 | .arg( i18n ("Birthday") ) |
138 | .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); | 137 | .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); |
139 | } | 138 | } |
140 | dynamicPart += getPhoneNumbers( false ); | 139 | dynamicPart += getPhoneNumbers( false ); |
141 | 140 | ||
142 | for ( ; emailIt != emails.end(); ++emailIt ) { | 141 | for ( ; emailIt != emails.end(); ++emailIt ) { |
143 | if ( kemailAvail ) { | 142 | if ( kemailAvail ) { |
144 | dynamicPart += QString( | 143 | dynamicPart += QString( |
145 | "<tr><td align=\"right\"><b>%1</b></td>" | 144 | "<tr><td align=\"right\"><b>%1</b></td>" |
146 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) | 145 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) |
147 | .arg( type ) | 146 | .arg( type ) |
148 | .arg( name ) | 147 | .arg( name ) |
149 | .arg( *emailIt ) | 148 | .arg( *emailIt ) |
150 | .arg( *emailIt ); | 149 | .arg( *emailIt ); |
151 | } else { | 150 | } else { |
152 | dynamicPart += QString( | 151 | dynamicPart += QString( |
153 | "<tr><td align=\"right\"><b>%1</b></td>" | 152 | "<tr><td align=\"right\"><b>%1</b></td>" |
154 | "<td align=\"left\">%2</td></tr>" ) | 153 | "<td align=\"left\">%2</td></tr>" ) |
155 | .arg( type ) | 154 | .arg( type ) |
156 | .arg( *emailIt ); | 155 | .arg( *emailIt ); |
157 | } | 156 | } |
158 | } | 157 | } |
159 | 158 | ||
160 | if ( !mAddressee.url().url().isEmpty() ) { | 159 | if ( !mAddressee.url().url().isEmpty() ) { |
161 | dynamicPart += QString( | 160 | dynamicPart += QString( |
162 | "<tr><td align=\"right\"><b>%1</b></td>" | 161 | "<tr><td align=\"right\"><b>%1</b></td>" |
163 | "<td align=\"left\">%2</td></tr>" ) | 162 | "<td align=\"left\">%2</td></tr>" ) |
164 | .arg( i18n( "Homepage" ) ) | 163 | .arg( i18n( "Homepage" ) ) |
165 | //US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); | 164 | //US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); |
166 | .arg( mAddressee.url().url() ); | 165 | .arg( mAddressee.url().url() ); |
167 | //qDebug("AddresseeView::setAddressee has to be verified."); | 166 | //qDebug("AddresseeView::setAddressee has to be verified."); |
168 | } | 167 | } |
169 | 168 | ||
170 | KABC::Address::List addresses = mAddressee.addresses(); | 169 | KABC::Address::List addresses = mAddressee.addresses(); |
171 | KABC::Address::List::ConstIterator addrIt; | 170 | KABC::Address::List::ConstIterator addrIt; |
172 | for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { | 171 | for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { |
173 | if ( true /*(*addrIt).label().isEmpty()*/ ) { | 172 | if ( true /*(*addrIt).label().isEmpty()*/ ) { |