summaryrefslogtreecommitdiffabout
path: root/kaddressbook/details/look_details.cpp
Unidiff
Diffstat (limited to 'kaddressbook/details/look_details.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/details/look_details.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/kaddressbook/details/look_details.cpp b/kaddressbook/details/look_details.cpp
index 11d06e9..2c3a79d 100644
--- a/kaddressbook/details/look_details.cpp
+++ b/kaddressbook/details/look_details.cpp
@@ -144,100 +144,100 @@ void KABDetailedView::paintEvent( QPaintEvent* )
144 case Bordered: 144 case Bordered:
145 p.drawTiledPixmap( 1, 1, QMIN( width() - 2, mCurrentBackground.width() ), 145 p.drawTiledPixmap( 1, 1, QMIN( width() - 2, mCurrentBackground.width() ),
146 height() - 2, mCurrentBackground ); 146 height() - 2, mCurrentBackground );
147 break; 147 break;
148 case None: // no BG image defined for this entry: 148 case None: // no BG image defined for this entry:
149 default: 149 default:
150 if ( mUseDefaultBGImage ) 150 if ( mUseDefaultBGImage )
151 p.drawTiledPixmap( 1, 1, width() - 2, height() - 2, mDefaultBGImage ); 151 p.drawTiledPixmap( 1, 1, width() - 2, height() - 2, mDefaultBGImage );
152 break; 152 break;
153 }; 153 };
154 154
155 p.setViewport( entryArea ); 155 p.setViewport( entryArea );
156 156
157 mPainter->setShowAddresses( mActionShowAddresses->isChecked() ); 157 mPainter->setShowAddresses( mActionShowAddresses->isChecked() );
158 mPainter->setShowEmails( mActionShowEmails->isChecked() ); 158 mPainter->setShowEmails( mActionShowEmails->isChecked() );
159 mPainter->setShowPhones( mActionShowPhones->isChecked() ); 159 mPainter->setShowPhones( mActionShowPhones->isChecked() );
160 mPainter->setShowURLs( mActionShowURLs->isChecked() ); 160 mPainter->setShowURLs( mActionShowURLs->isChecked() );
161 mPainter->printAddressee( addressee(), QRect( 0, 0, entryArea.width(), 161 mPainter->printAddressee( addressee(), QRect( 0, 0, entryArea.width(),
162 entryArea.height() ), &p ); 162 entryArea.height() ), &p );
163 p.end(); 163 p.end();
164 bitBlt( this, 0, 0, &pm ); 164 bitBlt( this, 0, 0, &pm );
165} 165}
166 166
167void KABDetailedView::mouseMoveEvent( QMouseEvent *e ) 167void KABDetailedView::mouseMoveEvent( QMouseEvent *e )
168{ 168{
169 QPoint bias( mGrid, mGrid ); 169 QPoint bias( mGrid, mGrid );
170 int rc; 170 int rc;
171 bool hit = false; 171 bool hit = false;
172 172
173 if ( ( rc = mPainter->hitsEmail( e->pos() - bias ) ) != -1 ) 173 if ( ( rc = mPainter->hitsEmail( e->pos() - bias ) ) != -1 )
174 hit = true; 174 hit = true;
175 else if ( ( rc = mPainter->hitsURL( e->pos() - bias ) ) != -1 ) 175 else if ( ( rc = mPainter->hitsURL( e->pos() - bias ) ) != -1 )
176 hit = true; 176 hit = true;
177 else if ( ( rc = mPainter->hitsPhone( e->pos() - bias ) ) != -1 ) 177 else if ( ( rc = mPainter->hitsPhone( e->pos() - bias ) ) != -1 )
178 hit = true; 178 hit = true;
179 else if ( ( rc = mPainter->hitsTalk( e->pos() - bias ) ) != -1 ) 179 else if ( ( rc = mPainter->hitsTalk( e->pos() - bias ) ) != -1 )
180 hit = true; 180 hit = true;
181 181
182 if ( hit ) { 182 if ( hit ) {
183 if ( cursor().shape() != PointingHandCursor ) 183 if ( cursor().shape() != PointingHandCursor )
184 setCursor( PointingHandCursor ); 184 setCursor( PointingHandCursor );
185 else if( cursor().shape() != ArrowCursor ) 185 else if( cursor().shape() != ArrowCursor )
186 setCursor(ArrowCursor); 186 setCursor(ArrowCursor);
187 } 187 }
188} 188}
189 189
190void KABDetailedView::mousePressEvent( QMouseEvent *e ) 190void KABDetailedView::mousePressEvent( QMouseEvent *e )
191{ 191{
192 QPopupMenu menu( this ); 192 Q3PopupMenu menu( this );
193 QPopupMenu *menuBG = new QPopupMenu( &menu ); 193 Q3PopupMenu *menuBG = new Q3PopupMenu( &menu );
194 mMenuBorderedBG = new QPopupMenu( &menu ); 194 mMenuBorderedBG = new Q3PopupMenu( &menu );
195 mMenuTiledBG = new QPopupMenu( &menu ); 195 mMenuTiledBG = new Q3PopupMenu( &menu );
196 196
197 menu.insertItem( i18n( "Select Background" ), menuBG ); 197 menu.insertItem( i18n( "Select Background" ), menuBG );
198 menuBG->insertItem( i18n( "Bordered Backgrounds" ), mMenuBorderedBG ); 198 menuBG->insertItem( i18n( "Bordered Backgrounds" ), mMenuBorderedBG );
199 menuBG->insertItem( i18n( "Tiled Backgrounds" ), mMenuTiledBG ); 199 menuBG->insertItem( i18n( "Tiled Backgrounds" ), mMenuTiledBG );
200 menu.insertSeparator(); 200 menu.insertSeparator();
201 201
202 QPoint point = e->pos() - QPoint( mGrid, mGrid ); 202 QPoint point = e->pos() - QPoint( mGrid, mGrid );
203 int rc; 203 int rc;
204 QStringList dirsBorderedBG, dirsTiledBG; 204 QStringList dirsBorderedBG, dirsTiledBG;
205 QDir dir; 205 QDir dir;
206 206
207 switch( e->button() ) { 207 switch( e->button() ) {
208 case QMouseEvent::RightButton: 208 case QMouseEvent::RightButton:
209 if ( isReadOnly() ) 209 if ( isReadOnly() )
210 menu.setItemEnabled( menu.idAt( 0 ), false ); 210 menu.setItemEnabled( menu.idAt( 0 ), false );
211 else { 211 else {
212 // TODO: settings need to be saved in view options 212 // TODO: settings need to be saved in view options
213 dirsBorderedBG = KGlobal::instance()->dirs()->findDirs( "data", mBorderedBGDir ); 213 dirsBorderedBG = KGlobal::instance()->dirs()->findDirs( "data", mBorderedBGDir );
214 if ( dirsBorderedBG.count() > 0 ) { 214 if ( dirsBorderedBG.count() > 0 ) {
215 dir.setPath( dirsBorderedBG[ 0 ] ); 215 dir.setPath( dirsBorderedBG[ 0 ] );
216 mBorders = dir.entryList( QDir::Files ); 216 mBorders = dir.entryList( QDir::Files );
217 for ( uint count = 0; count < mBorders.count(); ++count ) 217 for ( uint count = 0; count < mBorders.count(); ++count )
218 mMenuBorderedBG->insertItem( mBorders[ count ], count ); 218 mMenuBorderedBG->insertItem( mBorders[ count ], count );
219 219
220 connect( mMenuBorderedBG, SIGNAL( activated( int ) ), 220 connect( mMenuBorderedBG, SIGNAL( activated( int ) ),
221 SLOT( slotBorderedBGSelected( int ) ) ); 221 SLOT( slotBorderedBGSelected( int ) ) );
222 } else 222 } else
223 menuBG->setItemEnabled( menuBG->idAt( 0 ), false ); 223 menuBG->setItemEnabled( menuBG->idAt( 0 ), false );
224 224
225 dirsTiledBG = KGlobal::instance()->dirs()->findDirs( "data", mTiledBGDir ); 225 dirsTiledBG = KGlobal::instance()->dirs()->findDirs( "data", mTiledBGDir );
226 if ( dirsTiledBG.count() > 0 ) { 226 if ( dirsTiledBG.count() > 0 ) {
227 dir.setPath( dirsTiledBG[ 0 ] ); 227 dir.setPath( dirsTiledBG[ 0 ] );
228 mTiles = dir.entryList( QDir::Files ); 228 mTiles = dir.entryList( QDir::Files );
229 for ( uint count = 0; count < mTiles.count(); ++count ) 229 for ( uint count = 0; count < mTiles.count(); ++count )
230 mMenuTiledBG->insertItem( mTiles[ count ], count ); 230 mMenuTiledBG->insertItem( mTiles[ count ], count );
231 231
232 connect( mMenuTiledBG, SIGNAL( activated( int ) ), 232 connect( mMenuTiledBG, SIGNAL( activated( int ) ),
233 SLOT( slotTiledBGSelected( int ) ) ); 233 SLOT( slotTiledBGSelected( int ) ) );
234 } else 234 } else
235 menuBG->setItemEnabled( menuBG->idAt( 1 ), false ); 235 menuBG->setItemEnabled( menuBG->idAt( 1 ), false );
236 } 236 }
237 237
238 mActionShowAddresses->plug( &menu ); 238 mActionShowAddresses->plug( &menu );
239 mActionShowEmails->plug( &menu ); 239 mActionShowEmails->plug( &menu );
240 mActionShowPhones->plug( &menu ); 240 mActionShowPhones->plug( &menu );
241 mActionShowURLs->plug( &menu ); 241 mActionShowURLs->plug( &menu );
242 242
243 menu.exec( e->globalPos() ); 243 menu.exec( e->globalPos() );
@@ -369,51 +369,51 @@ void KABDetailedView::restoreSettings( KConfig *config )
369 369
370 config->setGroup( ConfigView ); 370 config->setGroup( ConfigView );
371 371
372 // load the default background image: 372 // load the default background image:
373 QString bgImage; 373 QString bgImage;
374 mUseDefaultBGImage = config->readBoolEntry( ConfigView_UseDefaultBackground, true ); 374 mUseDefaultBGImage = config->readBoolEntry( ConfigView_UseDefaultBackground, true );
375 mDefaultBGColor = config->readColorEntry( ConfigView_DefaultBackgroundColor, &white ); 375 mDefaultBGColor = config->readColorEntry( ConfigView_DefaultBackgroundColor, &white );
376 bgImage = config->readEntry( ConfigView_DefaultBackgroundImage, "konqueror/tiles/kenwimer.png" ); 376 bgImage = config->readEntry( ConfigView_DefaultBackgroundImage, "konqueror/tiles/kenwimer.png" );
377 377
378 if ( mUseDefaultBGImage ) { 378 if ( mUseDefaultBGImage ) {
379 uint count = 0; 379 uint count = 0;
380 QStringList dirs = KGlobal::instance()->dirs()->findDirs( "data", "/" ); 380 QStringList dirs = KGlobal::instance()->dirs()->findDirs( "data", "/" );
381 if ( !dirs.isEmpty() ) { 381 if ( !dirs.isEmpty() ) {
382 for ( count = 0; count < dirs.count(); ++count ) { 382 for ( count = 0; count < dirs.count(); ++count ) {
383 if ( getBackground( dirs[ count ] + "/" + bgImage, mDefaultBGImage ) ) 383 if ( getBackground( dirs[ count ] + "/" + bgImage, mDefaultBGImage ) )
384 break; 384 break;
385 } 385 }
386 } 386 }
387 387
388 if ( count == dirs.count() ) { 388 if ( count == dirs.count() ) {
389 mUseDefaultBGImage = getBackground( bgImage, mDefaultBGImage ); 389 mUseDefaultBGImage = getBackground( bgImage, mDefaultBGImage );
390 if ( !mUseDefaultBGImage ) 390 if ( !mUseDefaultBGImage )
391 kdDebug(5720) << "KABDetailedView::configure: " 391 kdDebug(5720) << "KABDetailedView::configure: "
392 << "default BG image selected, but could not be loaded." 392 << "default BG image selected, but could not be loaded."
393 << endl; 393 << endl;
394 } 394 }
395 } 395 }
396 396
397 mDefaultBGColor = config->readColorEntry( ConfigView_DefaultBackgroundColor, &white ); 397 mDefaultBGColor = config->readColorEntry( ConfigView_DefaultBackgroundColor, &white );
398 mHeadLineBGColor = config->readColorEntry( ConfigView_HeadlineBGColor, &darkBlue ); 398 mHeadLineBGColor = config->readColorEntry( ConfigView_HeadlineBGColor, &darkBlue );
399 mHeadLineTextColor = config->readColorEntry( ConfigView_HeadlineTextColor, &yellow ); 399 mHeadLineTextColor = config->readColorEntry( ConfigView_HeadlineTextColor, &yellow );
400 mUseHeadLineBGColor = config->readBoolEntry( ConfigView_UseHeadlineBGColor, true ); 400 mUseHeadLineBGColor = config->readBoolEntry( ConfigView_UseHeadlineBGColor, true );
401 401
402 if ( !mPainter ) 402 if ( !mPainter )
403 mPainter = new KABEntryPainter; 403 mPainter = new KABEntryPainter;
404 404
405 mPainter->setForegroundColor( black ); 405 mPainter->setForegroundColor( black );
406 mPainter->setHeaderColor( mHeadLineTextColor ); 406 mPainter->setHeaderColor( mHeadLineTextColor );
407 mPainter->setUseHeaderColor( mUseHeadLineBGColor ); 407 mPainter->setUseHeaderColor( mUseHeadLineBGColor );
408 mPainter->setBackgroundColor( mHeadLineBGColor ); 408 mPainter->setBackgroundColor( mHeadLineBGColor );
409 409
410 mPainter->setHeaderFont( QFont( gfont, gpointsize + 4, QFont::Bold, true ) ); 410 mPainter->setHeaderFont( QFont( gfont, gpointsize + 4, QFont::Bold, true ) );
411 mPainter->setHeadLineFont( QFont( gfont, gpointsize + 2, QFont::Bold, true ) ); 411 mPainter->setHeadLineFont( QFont( gfont, gpointsize + 2, QFont::Bold, true ) );
412 mPainter->setBodyFont( QFont( gfont, gpointsize, QFont::Normal, false ) ); 412 mPainter->setBodyFont( QFont( gfont, gpointsize, QFont::Normal, false ) );
413 mPainter->setFixedFont( QFont( ffont, fpointsize, QFont::Normal, false ) ); 413 mPainter->setFixedFont( QFont( ffont, fpointsize, QFont::Normal, false ) );
414 mPainter->setCommentFont( QFont( gfont, gpointsize, QFont::Normal, false ) ); 414 mPainter->setCommentFont( QFont( gfont, gpointsize, QFont::Normal, false ) );
415} 415}
416 416
417#ifndef KAB_EMBEDDED 417#ifndef KAB_EMBEDDED_
418#include "look_details.moc" 418#include "moc_look_details.cpp"
419#endif //KAB_EMBEDDED 419#endif //KAB_EMBEDDED