summaryrefslogtreecommitdiffstats
path: root/src/bookreader.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-21 04:48:07 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-21 04:48:07 +0000
commit0525bd68b1324389d0825761afec5d2ed252a9a5 (patch)
tree8a1cb1649c11510a8a8c9fbacc353bfdad74bad2 /src/bookreader.cpp
parent5cce0292935a57e7fab4417d428637fcb84315a9 (diff)
downloadkbookreader-0525bd68b1324389d0825761afec5d2ed252a9a5.tar.gz
kbookreader-0525bd68b1324389d0825761afec5d2ed252a9a5.zip
TQt4 port kbookreader
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kbookreader@1242484 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/bookreader.cpp')
-rw-r--r--src/bookreader.cpp116
1 files changed, 58 insertions, 58 deletions
diff --git a/src/bookreader.cpp b/src/bookreader.cpp
index 662d283..9687e56 100644
--- a/src/bookreader.cpp
+++ b/src/bookreader.cpp
@@ -42,12 +42,12 @@
#include <kurldrag.h>
#include <kurlrequesterdlg.h>
#include <kio/netaccess.h>
-#include <qdragobject.h>
-#include <qpainter.h>
-#include <qpaintdevicemetrics.h>
-#include <qpixmap.h>
-#include <qtextcodec.h>
-#include <qsignalmapper.h>
+#include <tqdragobject.h>
+#include <tqpainter.h>
+#include <tqpaintdevicemetrics.h>
+#include <tqpixmap.h>
+#include <tqtextcodec.h>
+#include <tqsignalmapper.h>
#include <assert.h>
#include "bookreader.h"
#include "settings.h"
@@ -55,10 +55,10 @@
#include "bookmarksdlg.h"
namespace {
-QStringList listEncodings()
+TQStringList listEncodings()
{
- const QStringList encodings(KGlobal::charsets()->availableEncodingNames());
- QStringList availEncodings;
+ const TQStringList encodings(KGlobal::charsets()->availableEncodingNames());
+ TQStringList availEncodings;
for (unsigned int i=0; i < encodings.count(); ++i)
{
bool found = false;
@@ -79,7 +79,7 @@ BookReader::BookReader()
m_printer(0)
{
- QPixmap splash(KGlobal::dirs()->findResource("appdata",
+ TQPixmap splash(KGlobal::dirs()->findResource("appdata",
"themes/default/splash.png"));
m_splash = new KSplashScreen(splash);
m_splash->show();
@@ -99,19 +99,19 @@ BookReader::BookReader()
// automatically save settings if changed: window size, toolbar
// position, icon size, etc. Also to add actions for the statusbar
// toolbar, and keybindings if necessary.
- KStdAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection());
+ KStdAction::keyBindings(guiFactory(), TQT_SLOT(configureShortcuts()), actionCollection());
createStandardStatusBarAction();
setStandardToolBarMenuEnabled( true );
- KStdAction::configureToolbars(this, SLOT(configureToolbars() ), actionCollection());
- createGUI(QString::null, false);
+ KStdAction::configureToolbars(TQT_TQOBJECT(this), TQT_SLOT(configureToolbars() ), actionCollection());
+ createGUI(TQString(), false);
initialGeometrySet();
setAutoSaveSettings();
// allow the view to change the statusbar and caption
- connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)),
- this, SLOT(changeStatusbar(const QString&)));
- connect(m_view, SIGNAL(signalChangeCaption(const QString&)),
- this, SLOT(changeCaption(const QString&)));
+ connect(m_view, TQT_SIGNAL(signalChangeStatusbar(const TQString&)),
+ TQT_TQOBJECT(this), TQT_SLOT(changeStatusbar(const TQString&)));
+ connect(m_view, TQT_SIGNAL(signalChangeCaption(const TQString&)),
+ TQT_TQOBJECT(this), TQT_SLOT(changeCaption(const TQString&)));
readSettings();
m_splash->finish(m_view);
@@ -125,7 +125,7 @@ BookReader::~BookReader()
void BookReader::load(const KURL& url)
{
- QString target;
+ TQString target;
// download the contents
if(!KIO::NetAccess::download(url, target, this))
{
@@ -141,29 +141,29 @@ void BookReader::load(const KURL& url)
void BookReader::setupActions()
{
-// KStdAction::openNew(this, SLOT(fileNew()), actionCollection());
- KStdAction::open(this, SLOT(fileOpen()), actionCollection());
- recentFilesAction = KStdAction::openRecent(this, SLOT(slotURLSelected(const KURL &)),
+// KStdAction::openNew(TQT_TQOBJECT(this), TQT_SLOT(fileNew()), actionCollection());
+ KStdAction::open(TQT_TQOBJECT(this), TQT_SLOT(fileOpen()), actionCollection());
+ recentFilesAction = KStdAction::openRecent(TQT_TQOBJECT(this), TQT_SLOT(slotURLSelected(const KURL &)),
actionCollection());
- KStdAction::save(this, SLOT(fileSave()), actionCollection());
- KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection());
- KStdAction::print(this, SLOT(filePrint()), actionCollection());
- KStdAction::quit(kapp, SLOT(quit()), actionCollection());
+ KStdAction::save(TQT_TQOBJECT(this), TQT_SLOT(fileSave()), actionCollection());
+ KStdAction::saveAs(TQT_TQOBJECT(this), TQT_SLOT(fileSaveAs()), actionCollection());
+ KStdAction::print(TQT_TQOBJECT(this), TQT_SLOT(filePrint()), actionCollection());
+ KStdAction::quit(TQT_TQOBJECT(kapp), TQT_SLOT(quit()), actionCollection());
- KStdAction::firstPage(this, SLOT(gotoFirstPage()), actionCollection());
- KStdAction::prior(this, SLOT(prevPage()), actionCollection());
- KStdAction::next(this, SLOT(nextPage()), actionCollection());
- KStdAction::lastPage(this, SLOT(gotoLastPage()), actionCollection());
+ KStdAction::firstPage(TQT_TQOBJECT(this), TQT_SLOT(gotoFirstPage()), actionCollection());
+ KStdAction::prior(TQT_TQOBJECT(this), TQT_SLOT(prevPage()), actionCollection());
+ KStdAction::next(TQT_TQOBJECT(this), TQT_SLOT(nextPage()), actionCollection());
+ KStdAction::lastPage(TQT_TQOBJECT(this), TQT_SLOT(gotoLastPage()), actionCollection());
- KStdAction::addBookmark(this, SLOT(addBookmark()), actionCollection());
- KStdAction::editBookmarks(this, SLOT(editBookmarks()), actionCollection());
+ KStdAction::addBookmark(TQT_TQOBJECT(this), TQT_SLOT(addBookmark()), actionCollection());
+ KStdAction::editBookmarks(TQT_TQOBJECT(this), TQT_SLOT(editBookmarks()), actionCollection());
- KStdAction::gotoPage(this, SLOT(gotoPage()), actionCollection());
+ KStdAction::gotoPage(TQT_TQOBJECT(this), TQT_SLOT(gotoPage()), actionCollection());
- m_fullScreenAction = KStdAction::fullScreen(this, SLOT(fullScreen()),
+ m_fullScreenAction = KStdAction::fullScreen(TQT_TQOBJECT(this), TQT_SLOT(fullScreen()),
actionCollection(), this);
- KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection());
+ KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(optionsPreferences()), actionCollection());
KConfig *config = kapp->config();
recentFilesAction->loadEntries(config);
@@ -172,7 +172,7 @@ void BookReader::setupActions()
// how to insert a custom menu and menu item
/*
KAction *custom = new KAction( i18n( "Cus&tom Menuitem" ), 0,
- this, SLOT( optionsPreferences() ),
+ TQT_TQOBJECT(this), TQT_SLOT( optionsPreferences() ),
actionCollection(), "custom_action" );*/
}
@@ -195,7 +195,7 @@ void BookReader::readProperties(KConfig */*config*/)
// the app is being restored. read in here whatever you wrote
// in 'saveProperties'
-// QString url = config->readPathEntry("lastURL");
+// TQString url = config->readPathEntry("lastURL");
// int currentPage = config->readEntry("currentPage").toInt();
/* Disable forawhile
if (!url.isEmpty())
@@ -206,16 +206,16 @@ void BookReader::readProperties(KConfig */*config*/)
*/
}
-void BookReader::dragEnterEvent(QDragEnterEvent *event)
+void BookReader::dragEnterEvent(TQDragEnterEvent *event)
{
// accept uri drops only
event->accept(KURLDrag::canDecode(event));
}
-void BookReader::dropEvent(QDropEvent *event)
+void BookReader::dropEvent(TQDropEvent *event)
{
// this is a very simplistic implementation of a drop event. we
- // will only accept a dropped URL. the Qt dnd code can do *much*
+ // will only accept a dropped URL. the TQt dnd code can do *much*
// much more, so please read the docs there
KURL::List urls;
@@ -237,7 +237,7 @@ void BookReader::fileOpen()
// button is clicked
/*
// this brings up the generic open dialog
- KURL url = KURLRequesterDlg::getURL(QString::null, this, i18n("Open Location") );
+ KURL url = KURLRequesterDlg::getURL(TQString(), this, i18n("Open Location") );
*/
// standard filedialog
KEncodingFileDialog::Result res =
@@ -276,14 +276,14 @@ void BookReader::filePrint()
if (!m_printer) m_printer = new KPrinter;
if (m_printer->setup(this))
{
- // setup the printer. with Qt, you always "print" to a
- // QPainter.. whether the output medium is a pixmap, a screen,
+ // setup the printer. with TQt, you always "print" to a
+ // TQPainter.. whether the output medium is a pixmap, a screen,
// or paper
- QPainter p;
+ TQPainter p;
p.begin(m_printer);
// we let our view do the actual printing
- QPaintDeviceMetrics metrics(m_printer);
+ TQPaintDeviceMetrics metrics(m_printer);
//m_view->print( &p, metrics.height(), metrics.width() );
// and send the result to the printer
@@ -300,11 +300,11 @@ void BookReader::optionsPreferences()
KDialogBase::IconList);
SettingsWidget *general = new SettingsWidget(0, "General");
- const QStringList encodings(listEncodings());
+ const TQStringList encodings(listEncodings());
- QString curEncoding(encodings[Settings::defaultEncoding()]);
+ TQString curEncoding(encodings[Settings::defaultEncoding()]);
if (curEncoding.isEmpty())
- curEncoding = QString::fromLatin1(KGlobal::locale()->encoding());
+ curEncoding = TQString::tqfromLatin1(KGlobal::locale()->encoding());
general->kcfg_DefaultEncoding->clear();
general->kcfg_DefaultEncoding->insertStringList(encodings);
@@ -313,17 +313,17 @@ void BookReader::optionsPreferences()
general->kcfg_DefaultEncoding->setCurrentItem(i);
dialog->addPage(general, i18n("General"), "settings");
- connect(dialog, SIGNAL(settingsChanged()), this, SLOT(loadSettings()));
+ connect(dialog, TQT_SIGNAL(settingsChanged()), TQT_TQOBJECT(this), TQT_SLOT(loadSettings()));
dialog->show();
}
-void BookReader::changeStatusbar(const QString& text)
+void BookReader::changeStatusbar(const TQString& text)
{
// display the text on the statusbar
statusBar()->message(text);
}
-void BookReader::changeCaption(const QString& text)
+void BookReader::changeCaption(const TQString& text)
{
// display the text on the caption
setCaption(text);
@@ -388,9 +388,9 @@ void BookReader::fullScreen()
void BookReader::loadLastUrl()
{
KConfig * config = kapp->config();
- QSize size = config->readSizeEntry("size");
+ TQSize size = config->readSizeEntry("size");
lastURL = config->readEntry("lastURL");
- connect(m_view, SIGNAL(loadingFinished()), this, SLOT(loadLastURLSetPage()));
+ connect(m_view, TQT_SIGNAL(loadingFinished()), TQT_TQOBJECT(this), TQT_SLOT(loadLastURLSetPage()));
if (!lastURL.isEmpty())
{
// kdDebug() << "loadLastUrl: initial size = " << m_view->size() << endl;
@@ -405,7 +405,7 @@ void BookReader::loadLastUrl()
void BookReader::loaded(int loaded)
{
//m_loaded = loaded;
- m_splash->message(tr("Loading: %1 - %2%").arg(lastURL.fileName()).arg(loaded));
+ m_splash->message(tqtr("Loading: %1 - %2%").tqarg(lastURL.fileName()).tqarg(loaded));
}
void BookReader::gotoFirstPage()
@@ -446,7 +446,7 @@ void BookReader::loadLastURLSetPage()
void BookReader::addBookmark()
{
bool isOk;
- QString name = KInputDialog::getText(tr("Add bookmark"),
+ TQString name = KInputDialog::getText(tr("Add bookmark"),
tr("Bookmark name"), tr("Here"), &isOk);
if (isOk)
{
@@ -465,13 +465,13 @@ void BookReader::updateBookmarks()
m_bookmarkActions.setAutoDelete(true);
const Bookmarks & bms = m_view->bookmarks();
- QSignalMapper *bookmarkMapper = new QSignalMapper(this);
- connect(bookmarkMapper, SIGNAL(mapped(int)), this, SLOT(gotoBookmark(int)));
+ TQSignalMapper *bookmarkMapper = new TQSignalMapper(TQT_TQOBJECT(this));
+ connect(bookmarkMapper, TQT_SIGNAL(mapped(int)), TQT_TQOBJECT(this), TQT_SLOT(gotoBookmark(int)));
for (Bookmarks::size_type i = 0; i < 9 && i < bms.size(); ++i)
{
const Bookmark & bm = bms[i];
KAction * action = new KAction(bm.name(), ALT+Key_1 + i);
- connect(action, SIGNAL(activated()), bookmarkMapper, SLOT(map()));
+ connect(action, TQT_SIGNAL(activated()), bookmarkMapper, TQT_SLOT(map()));
m_bookmarkActions.append(action);
bookmarkMapper->setMapping(action, i);
}
@@ -500,7 +500,7 @@ void BookReader::editBookmarks()
{
/// @todo implement me
BookmarksDlg dialog(m_view->bookmarks());
- if (dialog.exec() == QDialog::Accepted)
+ if (dialog.exec() == TQDialog::Accepted)
{
m_view->setBookmarks(dialog.bookmarks());
updateBookmarks();