summaryrefslogtreecommitdiffstats
path: root/src/gvimagepart/gvimagepart.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-26 21:04:57 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-26 21:04:57 +0000
commitbf7f88413be3831a9372d323d02fc0335b9f9188 (patch)
tree516fdef9206245b40a14f99b4e3d9ef9289196e0 /src/gvimagepart/gvimagepart.cpp
parente238aa77b1fb3c2f55aef2ef2c91ce52166d2cc8 (diff)
downloadgwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.tar.gz
gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.zip
TQt4 port Gwenview
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/gwenview@1233720 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gvimagepart/gvimagepart.cpp')
-rw-r--r--src/gvimagepart/gvimagepart.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/src/gvimagepart/gvimagepart.cpp b/src/gvimagepart/gvimagepart.cpp
index 6fcceee..8f273d6 100644
--- a/src/gvimagepart/gvimagepart.cpp
+++ b/src/gvimagepart/gvimagepart.cpp
@@ -18,10 +18,10 @@ Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "gvimagepart.moc"
-#include <qapplication.h>
-#include <qcursor.h>
-#include <qfile.h>
-#include <qpoint.h>
+#include <tqapplication.h>
+#include <tqcursor.h>
+#include <tqfile.h>
+#include <tqpoint.h>
#include <kaction.h>
#include <kapplication.h>
@@ -59,11 +59,11 @@ const char CONFIG_CACHE_GROUP[]="cache";
#endif
-static bool storeData(QWidget* parent, QFile* file, const QByteArray& data) {
+static bool storeData(TQWidget* tqparent, TQFile* file, const TQByteArray& data) {
uint sizeWritten = file->writeBlock(data);
if (sizeWritten != data.size()) {
KMessageBox::error(
- parent,
+ tqparent,
i18n("Could not save image to a temporary file"));
return false;
}
@@ -75,9 +75,9 @@ static bool storeData(QWidget* parent, QFile* file, const QByteArray& data) {
typedef KParts::GenericFactory<GVImagePart> GVImageFactory;
K_EXPORT_COMPONENT_FACTORY( libgvimagepart /*library name*/, GVImageFactory )
-GVImagePart::GVImagePart(QWidget* parentWidget, const char* /*widgetName*/, QObject* parent,
- const char* name, const QStringList &)
- : KParts::ReadOnlyPart( parent, name )
+GVImagePart::GVImagePart(TQWidget* tqparentWidget, const char* /*widgetName*/, TQObject* tqparent,
+ const char* name, const TQStringList &)
+ : KParts::ReadOnlyPart( tqparent, name )
, mPrefetch( NULL )
, mLastDirection( DirectionUnknown ) {
GVImageFactory::instance()->iconLoader()->addAppDir( "gwenview");
@@ -89,35 +89,35 @@ GVImagePart::GVImagePart(QWidget* parentWidget, const char* /*widgetName*/, QObj
// Create the widgets
mDocument = new Document(this);
- connect( mDocument, SIGNAL( loading()), SLOT( slotLoading()));
- connect( mDocument, SIGNAL( loaded(const KURL&)), SLOT( slotLoaded(const KURL&)));
- mImageView = new ImageView(parentWidget, mDocument, actionCollection());
- connect( mImageView, SIGNAL(requestContextMenu(const QPoint&)),
- this, SLOT(openContextMenu(const QPoint&)) );
+ connect( mDocument, TQT_SIGNAL( loading()), TQT_SLOT( slotLoading()));
+ connect( mDocument, TQT_SIGNAL( loaded(const KURL&)), TQT_SLOT( slotLoaded(const KURL&)));
+ mImageView = new ImageView(tqparentWidget, mDocument, actionCollection());
+ connect( mImageView, TQT_SIGNAL(requestContextMenu(const TQPoint&)),
+ this, TQT_SLOT(openContextMenu(const TQPoint&)) );
setWidget(mImageView);
mDirLister = new KDirLister;
mDirLister->setAutoErrorHandlingEnabled( false, 0 );
mDirLister->setMainWindow(KApplication::kApplication()->mainWidget());
- connect( mDirLister, SIGNAL( clear()), SLOT( dirListerClear()));
- connect( mDirLister, SIGNAL( newItems( const KFileItemList& )),
- SLOT( dirListerNewItems( const KFileItemList& )));
- connect(mDirLister,SIGNAL(deleteItem(KFileItem*)),
- SLOT(dirListerDeleteItem(KFileItem*)) );
+ connect( mDirLister, TQT_SIGNAL( clear()), TQT_SLOT( dirListerClear()));
+ connect( mDirLister, TQT_SIGNAL( newItems( const KFileItemList& )),
+ TQT_SLOT( dirListerNewItems( const KFileItemList& )));
+ connect(mDirLister,TQT_SIGNAL(deleteItem(KFileItem*)),
+ TQT_SLOT(dirListerDeleteItem(KFileItem*)) );
- QStringList mimeTypes=MimeTypeUtils::rasterImageMimeTypes();
+ TQStringList mimeTypes=MimeTypeUtils::rasterImageMimeTypes();
mDirLister->setMimeFilter(mimeTypes);
mPreviousImage=new KAction(i18n("&Previous Image"),
- QApplication::reverseLayout() ? "1rightarrow":"1leftarrow", Key_BackSpace,
- this,SLOT(slotSelectPrevious()), actionCollection(), "previous");
+ TQApplication::reverseLayout() ? "1rightarrow":"1leftarrow", Key_BackSpace,
+ this,TQT_SLOT(slotSelectPrevious()), actionCollection(), "previous");
mNextImage=new KAction(i18n("&Next Image"),
- QApplication::reverseLayout() ? "1leftarrow":"1rightarrow", Key_Space,
- this,SLOT(slotSelectNext()), actionCollection(), "next");
+ TQApplication::reverseLayout() ? "1leftarrow":"1rightarrow", Key_Space,
+ this,TQT_SLOT(slotSelectNext()), actionCollection(), "next");
updateNextPrevious();
- KStdAction::saveAs( this, SLOT(saveAs()), actionCollection(), "saveAs" );
- new KAction(i18n("Rotate &Left"), "rotate_ccw", CTRL + Key_L, this, SLOT(rotateLeft()), actionCollection(), "rotate_left");
- new KAction(i18n("Rotate &Right"), "rotate_cw", CTRL + Key_R, this, SLOT(rotateRight()), actionCollection(), "rotate_right");
+ KStdAction::saveAs( this, TQT_SLOT(saveAs()), actionCollection(), "saveAs" );
+ new KAction(i18n("Rotate &Left"), "rotate_ccw", CTRL + Key_L, this, TQT_SLOT(rotateLeft()), actionCollection(), "rotate_left");
+ new KAction(i18n("Rotate &Right"), "rotate_cw", CTRL + Key_R, this, TQT_SLOT(rotateRight()), actionCollection(), "rotate_right");
setXMLFile( "gvimagepart/gvimagepart.rc" );
}
@@ -163,9 +163,9 @@ bool GVImagePart::openURL(const KURL& url) {
return false;
}
KURL oldURLDir = m_url;
- oldURLDir.setFileName( QString::null );
+ oldURLDir.setFileName( TQString() );
KURL newURLDir = url;
- newURLDir.setFileName( QString::null );
+ newURLDir.setFileName( TQString() );
bool sameDir = oldURLDir == newURLDir;
m_url = url;
emit started( 0 );
@@ -181,7 +181,7 @@ bool GVImagePart::openURL(const KURL& url) {
return true;
}
-QString GVImagePart::filePath() {
+TQString GVImagePart::filePath() {
return m_file;
}
@@ -194,14 +194,14 @@ void GVImagePart::slotLoading() {
}
void GVImagePart::slotLoaded(const KURL& url) {
- QString caption = url.filename() + QString(" - %1x%2").arg(mDocument->width()).arg(mDocument->height());
+ TQString caption = url.filename() + TQString(" - %1x%2").tqarg(mDocument->width()).tqarg(mDocument->height());
emit setWindowCaption(caption);
emit completed();
emit setStatusBarText(i18n("Done."));
prefetchDone();
mPrefetch = ImageLoader::loader( mLastDirection == DirectionPrevious ? previousURL() : nextURL(),
this, BUSY_PRELOADING );
- connect( mPrefetch, SIGNAL( imageLoaded( bool )), SLOT( prefetchDone()));
+ connect( mPrefetch, TQT_SIGNAL( imageLoaded( bool )), TQT_SLOT( prefetchDone()));
}
void GVImagePart::prefetchDone() {
@@ -217,7 +217,7 @@ void GVImagePart::print() {
printer.setDocName( m_url.filename() );
KPrinter::addDialogPage( new PrintDialogPage( mDocument, mImageView, "GV page"));
- if (printer.setup(mImageView, QString::null, true)) {
+ if (printer.setup(mImageView, TQString(), true)) {
mDocument->print(&printer);
}
}
@@ -236,7 +236,7 @@ void GVImagePart::dirListerClear() {
}
void GVImagePart::dirListerNewItems( const KFileItemList& list ) {
- QPtrListIterator<KFileItem> it(list);
+ TQPtrListIterator<KFileItem> it(list);
for( ; it.current(); ++it ) {
mImagesInDirectory.append( (*it)->name());
}
@@ -250,7 +250,7 @@ void GVImagePart::dirListerDeleteItem( KFileItem* item ) {
}
void GVImagePart::updateNextPrevious() {
- QStringList::ConstIterator current = mImagesInDirectory.find( mDocument->filename());
+ TQStringList::ConstIterator current = mImagesInDirectory.tqfind( mDocument->filename());
if( current == mImagesInDirectory.end()) {
mNextImage->setEnabled( false );
mPreviousImage->setEnabled( false );
@@ -262,7 +262,7 @@ void GVImagePart::updateNextPrevious() {
}
KURL GVImagePart::nextURL() const {
- QStringList::ConstIterator current = mImagesInDirectory.find( mDocument->filename());
+ TQStringList::ConstIterator current = mImagesInDirectory.tqfind( mDocument->filename());
if( current == mImagesInDirectory.end()) {
return KURL();
}
@@ -286,7 +286,7 @@ void GVImagePart::slotSelectNext() {
}
KURL GVImagePart::previousURL() const {
- QStringList::ConstIterator current = mImagesInDirectory.find( mDocument->filename());
+ TQStringList::ConstIterator current = mImagesInDirectory.tqfind( mDocument->filename());
if( current == mImagesInDirectory.end() || current == mImagesInDirectory.begin()) {
return KURL();
}
@@ -340,30 +340,30 @@ void GVImagePart::saveOriginalAs() {
KURL srcURL = mDocument->url();
KURL dstURL = KFileDialog::getSaveURL(
srcURL.fileName(),
- QString::null,
+ TQString(),
widget());
if (!dstURL.isValid()) return;
// Try to get data from the cache to avoid downloading the image again.
- QByteArray data = Cache::instance()->file(srcURL);
+ TQByteArray data = Cache::instance()->file(srcURL);
if (data.size() == 0) {
// We need to read the image again. Let KIO::copy do the work.
KIO::Job* job = KIO::copy(srcURL, dstURL);
job->setWindow(widget());
- connect(job, SIGNAL(result(KIO::Job*)),
- this, SLOT(showJobError(KIO::Job*)) );
+ connect(job, TQT_SIGNAL(result(KIO::Job*)),
+ this, TQT_SLOT(showJobError(KIO::Job*)) );
return;
}
if (dstURL.isLocalFile()) {
// Destination is a local file, store it ourself
- QString path = dstURL.path();
- QFile file(path);
+ TQString path = dstURL.path();
+ TQFile file(path);
if (!file.open(IO_WriteOnly)) {
KMessageBox::error(
widget(),
- i18n("Could not open '%1' for writing.").arg(path));
+ i18n("Could not open '%1' for writing.").tqarg(path));
return;
}
storeData(widget(), &file, data);
@@ -375,7 +375,7 @@ void GVImagePart::saveOriginalAs() {
}
-DataUploader::DataUploader(QWidget* dialogParent, const QByteArray& data, const KURL& dstURL)
+DataUploader::DataUploader(TQWidget* dialogParent, const TQByteArray& data, const KURL& dstURL)
: mDialogParent(dialogParent)
{
mTempFile.setAutoDelete(true);
@@ -388,8 +388,8 @@ DataUploader::DataUploader(QWidget* dialogParent, const QByteArray& data, const
tmpURL.setPath(mTempFile.name());
KIO::Job* job = KIO::copy(tmpURL, dstURL);
job->setWindow(dialogParent);
- connect(job, SIGNAL(result(KIO::Job*)),
- this, SLOT(slotJobFinished(KIO::Job*)) );
+ connect(job, TQT_SIGNAL(result(KIO::Job*)),
+ this, TQT_SLOT(slotJobFinished(KIO::Job*)) );
}
@@ -407,18 +407,18 @@ void DataUploader::slotJobFinished(KIO::Job* job) {
*/
class PopupGUIClient : public KXMLGUIClient {
public:
- PopupGUIClient( KInstance *inst, const QString &doc ) {
+ PopupGUIClient( KInstance *inst, const TQString &doc ) {
setInstance( inst );
setXML( doc );
}
};
-void GVImagePart::openContextMenu(const QPoint& pos) {
- QString doc = KXMLGUIFactory::readConfigFile( "gvimagepartpopup.rc", true, instance() );
+void GVImagePart::openContextMenu(const TQPoint& pos) {
+ TQString doc = KXMLGUIFactory::readConfigFile( "gvimagepartpopup.rc", true, instance() );
PopupGUIClient guiClient(instance(), doc);
- KStdAction::saveAs( this, SLOT(saveAs()), guiClient.actionCollection(), "saveAs" );
+ KStdAction::saveAs( this, TQT_SLOT(saveAs()), guiClient.actionCollection(), "saveAs" );
KParts::URLArgs urlArgs;
urlArgs.serviceType = mDocument->mimeType();