From 7be55ffa061c026e35e2d6a0effe1161ddb0d41f Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:53:50 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kaddressbook/thumbnailcreator/ldifvcardcreator.cpp | 60 +++++++++++----------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'kaddressbook/thumbnailcreator/ldifvcardcreator.cpp') diff --git a/kaddressbook/thumbnailcreator/ldifvcardcreator.cpp b/kaddressbook/thumbnailcreator/ldifvcardcreator.cpp index 4c8a5611e..0ed562e18 100644 --- a/kaddressbook/thumbnailcreator/ldifvcardcreator.cpp +++ b/kaddressbook/thumbnailcreator/ldifvcardcreator.cpp @@ -26,12 +26,12 @@ * */ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include @@ -64,18 +64,18 @@ VCard_LDIFCreator::~VCard_LDIFCreator() } -bool VCard_LDIFCreator::readContents( const QString &path ) +bool VCard_LDIFCreator::readContents( const TQString &path ) { // read file contents - QFile file( path ); + TQFile file( path ); if ( !file.open( IO_ReadOnly ) ) return false; - QString info; + TQString info; text.truncate(0); // read the file - QString contents = file.readAll(); + TQString contents = file.readAll(); file.close(); // convert the file contents to a KABC::Addressee address @@ -117,9 +117,9 @@ bool VCard_LDIFCreator::readContents( const QString &path ) KABC::PhoneNumber::List pnList = addr.phoneNumbers(); - QStringList phoneNumbers; + TQStringList phoneNumbers; for (unsigned int no=0; nosetPixmap( QPixmap( pixmap ) ); - mSplitter->setItemSize( QSize( 4, 7 ) ); + mSplitter->setPixmap( TQPixmap( pixmap ) ); + mSplitter->setItemSize( TQSize( 4, 7 ) ); } - QSize chSize = mSplitter->itemSize(); // the size of one char + TQSize chSize = mSplitter->itemSize(); // the size of one char int xOffset = chSize.width(); int yOffset = chSize.height(); @@ -172,7 +172,7 @@ bool VCard_LDIFCreator::createImageSmall() int numLines = (int) (canvasHeight / chSize.height()); // render the information - QRect rect; + TQRect rect; int rest = mPixmap.width() - (numCharsPerLine * chSize.width()); xborder = QMAX( xborder, rest / 2 ); // center horizontally rest = mPixmap.height() - (numLines * chSize.height()); @@ -184,7 +184,7 @@ bool VCard_LDIFCreator::createImageSmall() int posLastLine = mPixmap.height() - (chSize.height() + yborder); bool newLine = false; Q_ASSERT( posNewLine > 0 ); - const QPixmap *fontPixmap = &(mSplitter->pixmap()); + const TQPixmap *fontPixmap = &(mSplitter->pixmap()); for ( uint i = 0; i < text.length(); i++ ) { if ( x > posNewLine || newLine ) { // start a new line? @@ -206,7 +206,7 @@ bool VCard_LDIFCreator::createImageSmall() } // check for newlines in the text (unix,dos) - QChar ch = text.at( i ); + TQChar ch = text.at( i ); if ( ch == '\n' ) { newLine = true; continue; @@ -218,7 +218,7 @@ bool VCard_LDIFCreator::createImageSmall() rect = mSplitter->coordinates( ch ); if ( !rect.isEmpty() ) - bitBlt( &mPixmap, QPoint(x,y), fontPixmap, rect, Qt::CopyROP ); + bitBlt( &mPixmap, TQPoint(x,y), fontPixmap, rect, Qt::CopyROP ); x += xOffset; // next character } @@ -228,19 +228,19 @@ bool VCard_LDIFCreator::createImageSmall() bool VCard_LDIFCreator::createImageBig() { - QFont normalFont( KGlobalSettings::generalFont() ); - QFont titleFont( normalFont ); + TQFont normalFont( KGlobalSettings::generalFont() ); + TQFont titleFont( normalFont ); titleFont.setBold(true); // titleFont.setUnderline(true); titleFont.setItalic(true); - QPainter painter(&mPixmap); + TQPainter painter(&mPixmap); painter.setFont(titleFont); - QFontMetrics fm(painter.fontMetrics()); + TQFontMetrics fm(painter.fontMetrics()); // draw contact name painter.setClipRect(2, 2, pixmapSize.width()-4, pixmapSize.height()-4); - QPoint p(5, fm.height()+2); + TQPoint p(5, fm.height()+2); painter.drawText(p, name); p.setY( 3*p.y()/2 ); @@ -248,8 +248,8 @@ bool VCard_LDIFCreator::createImageBig() painter.setFont(normalFont); fm = painter.fontMetrics(); - const QStringList list( QStringList::split('\n', text) ); - for ( QStringList::ConstIterator it = list.begin(); + const TQStringList list( TQStringList::split('\n', text) ); + for ( TQStringList::ConstIterator it = list.begin(); p.y()<=pixmapSize.height() && it != list.end(); ++it ) { p.setY( p.y() + fm.height() ); painter.drawText(p, *it); @@ -258,13 +258,13 @@ bool VCard_LDIFCreator::createImageBig() return true; } -bool VCard_LDIFCreator::create(const QString &path, int width, int height, QImage &img) +bool VCard_LDIFCreator::create(const TQString &path, int width, int height, TQImage &img) { if ( !readContents(path) ) return false; // resize the image if necessary - pixmapSize = QSize( width, height ); + pixmapSize = TQSize( width, height ); if (height * 3 > width * 4) pixmapSize.setHeight( width * 4 / 3 ); else @@ -273,7 +273,7 @@ bool VCard_LDIFCreator::create(const QString &path, int width, int height, QImag if ( pixmapSize != mPixmap.size() ) mPixmap.resize( pixmapSize ); - mPixmap.fill( QColor( 245, 245, 245 ) ); // light-grey background + mPixmap.fill( TQColor( 245, 245, 245 ) ); // light-grey background // one pixel for the rectangle, the rest. whitespace xborder = 1 + pixmapSize.width()/16; // minimum x-border -- cgit v1.2.1