diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-18 17:00:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-18 17:00:31 +0000 |
commit | 395a904bff7b4d6ead445c342f7ac0c5fbf29121 (patch) | |
tree | 9829cadb79d2cc7c29a940627fadb28b11e54150 /konq-plugins/kimgalleryplugin/imgalleryplugin.cpp | |
parent | 399f47c376fdf4d19192732a701ea9578d11619d (diff) | |
download | tdeaddons-395a904bff7b4d6ead445c342f7ac0c5fbf29121.tar.gz tdeaddons-395a904bff7b4d6ead445c342f7ac0c5fbf29121.zip |
TQt4 port kdeaddons
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1237404 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konq-plugins/kimgalleryplugin/imgalleryplugin.cpp')
-rw-r--r-- | konq-plugins/kimgalleryplugin/imgalleryplugin.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/konq-plugins/kimgalleryplugin/imgalleryplugin.cpp b/konq-plugins/kimgalleryplugin/imgalleryplugin.cpp index 4b9a5e0..2b33df4 100644 --- a/konq-plugins/kimgalleryplugin/imgalleryplugin.cpp +++ b/konq-plugins/kimgalleryplugin/imgalleryplugin.cpp @@ -48,8 +48,8 @@ Boston, MA 02110-1301, USA. typedef KGenericFactory<KImGalleryPlugin> KImGalleryPluginFactory; K_EXPORT_COMPONENT_FACTORY( libkimgallery, KImGalleryPluginFactory( "imgalleryplugin" ) ) -KImGalleryPlugin::KImGalleryPlugin( TQObject* parent, const char* name, const TQStringList & ) - : KParts::Plugin( parent, name ), m_commentMap(0) +KImGalleryPlugin::KImGalleryPlugin( TQObject* tqparent, const char* name, const TQStringList & ) + : KParts::Plugin( tqparent, name ), m_commentMap(0) { new KAction( i18n( "&Create Image Gallery..." ), "imagegallery", CTRL+Key_I, this, TQT_SLOT( slotExecute() ), actionCollection(), "create_img_gallery" ); @@ -58,12 +58,12 @@ KImGalleryPlugin::KImGalleryPlugin( TQObject* parent, const char* name, const TQ void KImGalleryPlugin::slotExecute() { m_progressDlg=0L; - if ( !parent() || !parent()->inherits("KonqDirPart")) + if ( !tqparent() || !tqparent()->inherits("KonqDirPart")) { KMessageBox::sorry( 0L, i18n("Could not create the plugin, please report a bug.")); return; } - m_part = static_cast<KonqDirPart *>(parent()); + m_part = static_cast<KonqDirPart *>(tqparent()); if (!m_part->url().isLocalFile()) { //TODO support remote URLs too? KMessageBox::sorry(m_part->widget(), i18n("Creating an image gallery works only on local folders.")); return; @@ -105,7 +105,7 @@ bool KImGalleryPlugin::createDirectory(TQDir thumb_dir, TQString imgGalleryDir, if (!thumb_dir.exists()) { thumb_dir.setPath( imgGalleryDir); if (!(thumb_dir.mkdir(dirName, false))) { - KMessageBox::sorry(m_part->widget(), i18n("Couldn't create folder: %1").arg(thumb_dir.path())); + KMessageBox::sorry(m_part->widget(), i18n("Couldn't create folder: %1").tqarg(thumb_dir.path())); return false; } else { thumb_dir.setPath( imgGalleryDir + "/" + dirName + "/" ); @@ -155,7 +155,7 @@ TQString KImGalleryPlugin::extension(const TQString& imageFormat) if (imageFormat == "JPEG") return ".jpg"; Q_ASSERT(false); - return TQString::null; + return TQString(); } void KImGalleryPlugin::createBody(TQTextStream& stream, const TQString& sourceDirName, const TQStringList& subDirList, @@ -163,11 +163,11 @@ void KImGalleryPlugin::createBody(TQTextStream& stream, const TQString& sourceDi { int numOfImages = imageDir.count(); const TQString imgGalleryDir = url.directory(); - const TQString today(KGlobal::locale()->formatDate(TQDate::currentDate())); + const TQString today(KGlobal::locale()->formatDate(TQDate::tqcurrentDate())); stream << "<body>\n<h1>" << TQStyleSheet::escape(m_configDlg->getTitle()) << "</h1><p>" << endl; - stream << i18n("<i>Number of images</i>: %1").arg(numOfImages) << "<br/>" << endl; - stream << i18n("<i>Created on</i>: %1").arg(today) << "</p>" << endl; + stream << i18n("<i>Number of images</i>: %1").tqarg(numOfImages) << "<br/>" << endl; + stream << i18n("<i>Created on</i>: %1").tqarg(today) << "</p>" << endl; stream << "<hr/>" << endl; @@ -205,10 +205,10 @@ void KImGalleryPlugin::createBody(TQTextStream& stream, const TQString& sourceDi const TQString imgPath("thumbs/" + imgName + extension(imageFormat)); stream << "<img src=\"" << imgPath << "\" width=\"" << m_imgWidth << "\" "; stream << "height=\"" << m_imgHeight << "\" alt=\"" << imgPath << "\"/>"; - m_progressDlg->setLabelText( i18n("Created thumbnail for: \n%1").arg(imgName) ); + m_progressDlg->setLabelText( i18n("Created thumbnail for: \n%1").tqarg(imgName) ); } else { kdDebug(90170) << "Creating thumbnail for " << imgName << " failed" << endl; - m_progressDlg->setLabelText( i18n("Creating thumbnail for: \n%1\n failed").arg(imgName) ); + m_progressDlg->setLabelText( i18n("Creating thumbnail for: \n%1\n failed").tqarg(imgName) ); } stream << "</a>" << endl; @@ -249,9 +249,9 @@ bool KImGalleryPlugin::createHtml(const KURL& url, const TQString& sourceDirName if(m_cancelled) return false; - if( !parent() || !parent()->inherits("KonqDirPart")) + if( !tqparent() || !tqparent()->inherits("KonqDirPart")) return false; - KonqDirPart * part = static_cast<KonqDirPart *>(parent()); + KonqDirPart * part = static_cast<KonqDirPart *>(tqparent()); TQStringList subDirList; if (m_recurseSubDirectories && (recursionLevel >= 0)) { //recursionLevel == 0 means endless @@ -266,7 +266,7 @@ bool KImGalleryPlugin::createHtml(const KURL& url, const TQString& sourceDirName if (!subDir.exists()) { subDir.setPath( url.directory() ); if (!(subDir.mkdir(currentDir, false))) { - KMessageBox::sorry(part->widget(), i18n("Couldn't create folder: %1").arg(subDir.path())); + KMessageBox::sorry(part->widget(), i18n("Couldn't create folder: %1").tqarg(subDir.path())); continue; } else { subDir.setPath( url.directory() + "/" + currentDir ); @@ -293,12 +293,12 @@ bool KImGalleryPlugin::createHtml(const KURL& url, const TQString& sourceDirName kdDebug(90170) << "imgGalleryDir: " << imgGalleryDir << endl; // Create the "thumbs" subdirectory if necessary - TQDir thumb_dir( imgGalleryDir + TQString::fromLatin1("/thumbs/")); + TQDir thumb_dir( imgGalleryDir + TQString::tqfromLatin1("/thumbs/")); if (createDirectory(thumb_dir, imgGalleryDir, "thumbs") == false) return false; // Create the "images" subdirectory if necessary - TQDir images_dir( imgGalleryDir + TQString::fromLatin1("/images/")); + TQDir images_dir( imgGalleryDir + TQString::tqfromLatin1("/images/")); if (m_copyFiles) { if (createDirectory(images_dir, imgGalleryDir, "images") == false) return false; @@ -320,7 +320,7 @@ bool KImGalleryPlugin::createHtml(const KURL& url, const TQString& sourceDirName return !m_cancelled; } else { - KMessageBox::sorry(m_part->widget(),i18n("Couldn't open file: %1").arg(url.path(+1))); + KMessageBox::sorry(m_part->widget(),i18n("Couldn't open file: %1").tqarg(url.path(+1))); return false; } } @@ -344,8 +344,8 @@ void KImGalleryPlugin::deleteCancelledGallery(const KURL& url, const TQString& s } const TQString imgGalleryDir = url.directory(); - TQDir thumb_dir( imgGalleryDir + TQString::fromLatin1("/thumbs/")); - TQDir images_dir( imgGalleryDir + TQString::fromLatin1("/images/")); + TQDir thumb_dir( imgGalleryDir + TQString::tqfromLatin1("/thumbs/")); + TQDir images_dir( imgGalleryDir + TQString::tqfromLatin1("/images/")); TQDir imageDir( sourceDirName, "*.png *.PNG *.gif *.GIF *.jpg *.JPG *.jpeg *.JPEG *.bmp *.BMP", TQDir::Name|TQDir::IgnoreCase, TQDir::Files|TQDir::Readable); TQFile file( url.path() ); @@ -392,7 +392,7 @@ void KImGalleryPlugin::loadCommentFile() // Lines starting with '#' are comment if (!(curLineStripped.isEmpty()) && !curLineStripped.startsWith("#")) { if (curLineStripped.endsWith(":")) { - picComment = TQString::null; + picComment = TQString(); picName = curLineStripped.left(curLineStripped.length()-1); kdDebug(90170) << "picName: " << picName << endl; } else { @@ -415,7 +415,7 @@ void KImGalleryPlugin::loadCommentFile() kdDebug(90170) << "File closed." << endl; delete m_textStream; } else { - KMessageBox::sorry(m_part->widget(), i18n("Couldn't open file: %1").arg(m_configDlg->getCommentFile())); + KMessageBox::sorry(m_part->widget(), i18n("Couldn't open file: %1").tqarg(m_configDlg->getCommentFile())); m_useCommentFile = false; } } @@ -424,18 +424,18 @@ bool KImGalleryPlugin::createThumb( const TQString& imgName, const TQString& sou const TQString& imgGalleryDir, const TQString& imageFormat) { TQImage img; - const TQString pixPath = sourceDirName + TQString::fromLatin1("/") + imgName; + const TQString pixPath = sourceDirName + TQString::tqfromLatin1("/") + imgName; if (m_copyFiles) { KURL srcURL = KURL::fromPathOrURL(pixPath); //kdDebug(90170) << "srcURL: " << srcURL << endl; - KURL destURL = KURL::fromPathOrURL(imgGalleryDir + TQString::fromLatin1("/images/") + imgName); + KURL destURL = KURL::fromPathOrURL(imgGalleryDir + TQString::tqfromLatin1("/images/") + imgName); //kdDebug(90170) << "destURL: " << destURL << endl; - KIO::NetAccess::copy(srcURL, destURL, static_cast<KParts::Part *>(parent())->widget()); + KIO::NetAccess::copy(srcURL, destURL, static_cast<KParts::Part *>(tqparent())->widget()); } const TQString imgNameFormat = imgName + extension(imageFormat); - const TQString thumbDir = imgGalleryDir + TQString::fromLatin1("/thumbs/"); + const TQString thumbDir = imgGalleryDir + TQString::tqfromLatin1("/thumbs/"); int extent = m_configDlg->getThumbnailSize(); // this code is stolen from kdebase/kioslave/thumbnail/imagecreator.cpp |