summaryrefslogtreecommitdiffstats
path: root/src/entryview.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-02 06:40:27 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-02 06:40:27 +0000
commit2595a15ebeb6fc46b7cb241d01ec0c2460ec2111 (patch)
tree18a8f0f4ac5a86dacfa74c3537551ec39bc85e75 /src/entryview.cpp
parent1d90725a4001fab9d3922b2cbcceeee5e2d1686f (diff)
downloadtellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.tar.gz
tellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.zip
TQt4 port tellico
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1239054 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/entryview.cpp')
-rw-r--r--src/entryview.cpp112
1 files changed, 56 insertions, 56 deletions
diff --git a/src/entryview.cpp b/src/entryview.cpp
index c4b0d38..9019d18 100644
--- a/src/entryview.cpp
+++ b/src/entryview.cpp
@@ -36,25 +36,25 @@
#include <ktempfile.h>
#include <klocale.h>
-#include <qfile.h>
+#include <tqfile.h>
using Tellico::EntryView;
-EntryView::EntryView(QWidget* parent_, const char* name_) : KHTMLPart(parent_, name_),
+EntryView::EntryView(TQWidget* tqparent_, const char* name_) : KHTMLPart(tqparent_, name_),
m_entry(0), m_handler(0), m_run(0), m_tempFile(0), m_useGradientImages(true), m_checkCommonFile(true) {
setJScriptEnabled(false);
setJavaEnabled(false);
setMetaRefreshEnabled(false);
setPluginsEnabled(false);
- clear(); // needed for initial layout
+ clear(); // needed for initial tqlayout
view()->setAcceptDrops(true);
DropHandler* drophandler = new DropHandler(this);
view()->installEventFilter(drophandler);
- connect(browserExtension(), SIGNAL(openURLRequest(const KURL&, const KParts::URLArgs&)),
- SLOT(slotOpenURL(const KURL&)));
- connect(kapp, SIGNAL(kdisplayPaletteChanged()), SLOT(slotResetColors()));
+ connect(browserExtension(), TQT_SIGNAL(openURLRequest(const KURL&, const KParts::URLArgs&)),
+ TQT_SLOT(slotOpenURL(const KURL&)));
+ connect(kapp, TQT_SIGNAL(kdisplayPaletteChanged()), TQT_SLOT(slotResetColors()));
}
EntryView::~EntryView() {
@@ -76,7 +76,7 @@ void EntryView::clear() {
write(m_textToShow);
}
end();
- view()->layout(); // I need this because some of the margins and widths may get messed up
+ view()->tqlayout(); // I need this because some of the margins and widths may get messed up
}
void EntryView::showEntry(Data::EntryPtr entry_) {
@@ -85,7 +85,7 @@ void EntryView::showEntry(Data::EntryPtr entry_) {
return;
}
- m_textToShow = QString();
+ m_textToShow = TQString();
#if 0
kdWarning() << "EntryView::showEntry() - turn me off!" << endl;
m_entry = 0;
@@ -116,24 +116,24 @@ void EntryView::showEntry(Data::EntryPtr entry_) {
opt |= Export::ExportClean;
}
exporter.setOptions(opt);
- QDomDocument dom = exporter.exportXML();
+ TQDomDocument dom = exporter.exportXML();
// myDebug() << dom.toString() << endl;
#if 0
kdWarning() << "EntryView::showEntry() - turn me off!" << endl;
- QFile f1(QString::fromLatin1("/tmp/test.xml"));
+ TQFile f1(TQString::tqfromLatin1("/tmp/test.xml"));
if(f1.open(IO_WriteOnly)) {
- QTextStream t(&f1);
+ TQTextStream t(&f1);
t << dom.toString();
}
f1.close();
#endif
- QString html = m_handler->applyStylesheet(dom.toString());
+ TQString html = m_handler->applyStylesheet(dom.toString());
// write out image files
Data::FieldVec fields = entry_->collection()->imageFields();
for(Data::FieldVec::Iterator field = fields.begin(); field != fields.end(); ++field) {
- QString id = entry_->field(field);
+ TQString id = entry_->field(field);
if(id.isEmpty()) {
continue;
}
@@ -146,9 +146,9 @@ void EntryView::showEntry(Data::EntryPtr entry_) {
#if 0
kdWarning() << "EntryView::showEntry() - turn me off!" << endl;
- QFile f2(QString::fromLatin1("/tmp/test.html"));
+ TQFile f2(TQString::tqfromLatin1("/tmp/test.html"));
if(f2.open(IO_WriteOnly)) {
- QTextStream t(&f2);
+ TQTextStream t(&f2);
t << html;
}
f2.close();
@@ -158,35 +158,35 @@ void EntryView::showEntry(Data::EntryPtr entry_) {
write(html);
end();
// not need anymore?
- view()->layout(); // I need this because some of the margins and widths may get messed up
+ view()->tqlayout(); // I need this because some of the margins and widths may get messed up
}
-void EntryView::showText(const QString& text_) {
+void EntryView::showText(const TQString& text_) {
m_textToShow = text_;
begin();
write(text_);
end();
}
-void EntryView::setXSLTFile(const QString& file_) {
- QString oldFile = m_xsltFile;
+void EntryView::setXSLTFile(const TQString& file_) {
+ TQString oldFile = m_xsltFile;
// if starts with slash, then absolute path
if(file_.at(0) == '/') {
m_xsltFile = file_;
} else {
- const QString templateDir = QString::fromLatin1("entry-templates/");
+ const TQString templateDir = TQString::tqfromLatin1("entry-templates/");
m_xsltFile = locate("appdata", templateDir + file_);
if(m_xsltFile.isEmpty()) {
if(!file_.isEmpty()) {
kdWarning() << "EntryView::setXSLTFile() - can't locate " << file_ << endl;
}
- m_xsltFile = locate("appdata", templateDir + QString::fromLatin1("Fancy.xsl"));
+ m_xsltFile = locate("appdata", templateDir + TQString::tqfromLatin1("Fancy.xsl"));
if(m_xsltFile.isEmpty()) {
- QString str = QString::fromLatin1("<qt>");
+ TQString str = TQString::tqfromLatin1("<qt>");
str += i18n("Tellico is unable to locate the default entry stylesheet.");
- str += QChar(' ');
+ str += TQChar(' ');
str += i18n("Please check your installation.");
- str += QString::fromLatin1("</qt>");
+ str += TQString::tqfromLatin1("</qt>");
KMessageBox::error(view(), str);
clear();
return;
@@ -204,22 +204,22 @@ void EntryView::setXSLTFile(const QString& file_) {
if(m_handler && reloadImages) {
// the only two colors that matter for the gradients are the base color
// and highlight base color
- const QCString& oldBase = m_handler->param("bgcolor");
- const QCString& oldHigh = m_handler->param("color2");
+ const TQCString& oldBase = m_handler->param("bgcolor");
+ const TQCString& oldHigh = m_handler->param("color2");
// remember the string params have apostrophes on either side, so we can start search at pos == 1
- reloadImages = oldBase.find(Config::templateBaseColor(type).name().latin1(), 1) == -1
- || oldHigh.find(Config::templateHighlightedBaseColor(type).name().latin1(), 1) == -1;
+ reloadImages = oldBase.tqfind(TQString(Config::templateBaseColor(type).name()).latin1(), 1) == -1
+ || oldHigh.tqfind(TQString(Config::templateHighlightedBaseColor(type).name()).latin1(), 1) == -1;
}
if(!m_handler || m_xsltFile != oldFile) {
delete m_handler;
// must read the file name to get proper context
- m_handler = new XSLTHandler(QFile::encodeName(m_xsltFile));
+ m_handler = new XSLTHandler(TQFile::encodeName(m_xsltFile));
if(m_checkCommonFile && !m_handler->isValid()) {
NewStuff::Manager::checkCommonFile();
m_checkCommonFile = false;
delete m_handler;
- m_handler = new XSLTHandler(QFile::encodeName(m_xsltFile));
+ m_handler = new XSLTHandler(TQFile::encodeName(m_xsltFile));
}
if(!m_handler->isValid()) {
kdWarning() << "EntryView::setXSLTFile() - invalid xslt handler" << endl;
@@ -230,22 +230,22 @@ void EntryView::setXSLTFile(const QString& file_) {
}
}
- m_handler->addStringParam("font", Config::templateFont(type).family().latin1());
- m_handler->addStringParam("fontsize", QCString().setNum(Config::templateFont(type).pointSize()));
- m_handler->addStringParam("bgcolor", Config::templateBaseColor(type).name().latin1());
- m_handler->addStringParam("fgcolor", Config::templateTextColor(type).name().latin1());
- m_handler->addStringParam("color1", Config::templateHighlightedTextColor(type).name().latin1());
- m_handler->addStringParam("color2", Config::templateHighlightedBaseColor(type).name().latin1());
+ m_handler->addStringParam("font", TQString(Config::templateFont(type).family()).latin1());
+ m_handler->addStringParam("fontsize", TQCString().setNum(Config::templateFont(type).pointSize()));
+ m_handler->addStringParam("bgcolor", TQString(Config::templateBaseColor(type).name()).latin1());
+ m_handler->addStringParam("fgcolor", TQString(Config::templateTextColor(type).name()).latin1());
+ m_handler->addStringParam("color1", TQString(Config::templateHighlightedTextColor(type).name()).latin1());
+ m_handler->addStringParam("color2", TQString(Config::templateHighlightedBaseColor(type).name()).latin1());
if(Data::Document::self()->allImagesOnDisk()) {
- m_handler->addStringParam("imgdir", QFile::encodeName(ImageFactory::dataDir()));
+ m_handler->addStringParam("imgdir", TQFile::encodeName(ImageFactory::dataDir()));
} else {
- m_handler->addStringParam("imgdir", QFile::encodeName(ImageFactory::tempDir()));
+ m_handler->addStringParam("imgdir", TQFile::encodeName(ImageFactory::tempDir()));
}
// look for a file that gets installed to know the installation directory
- QString appdir = KGlobal::dirs()->findResourceDir("appdata", QString::fromLatin1("pics/tellico.png"));
- m_handler->addStringParam("datadir", QFile::encodeName(appdir));
+ TQString appdir = KGlobal::dirs()->findResourceDir("appdata", TQString::tqfromLatin1("pics/tellico.png"));
+ m_handler->addStringParam("datadir", TQFile::encodeName(appdir));
// if we don't have to reload the images, then just show the entry and we're done
if(!reloadImages) {
@@ -260,13 +260,13 @@ void EntryView::setXSLTFile(const QString& file_) {
void EntryView::slotRefresh() {
setXSLTFile(m_xsltFile);
showEntry(m_entry);
- view()->repaint();
+ view()->tqrepaint();
}
// do some contortions in case the url is relative
// need to interpret it relative to document URL instead of xslt file
// the current node under the mouse vould be the text node inside
-// the anchor node, so iterate up the parents
+// the anchor node, so iterate up the tqparents
void EntryView::slotOpenURL(const KURL& url_) {
if(url_.protocol() == Latin1Literal("tc")) {
// handle this internally
@@ -277,7 +277,7 @@ void EntryView::slotOpenURL(const KURL& url_) {
KURL u = url_;
for(DOM::Node node = nodeUnderMouse(); !node.isNull(); node = node.parentNode()) {
if(node.nodeType() == DOM::Node::ELEMENT_NODE && static_cast<DOM::Element>(node).tagName() == "a") {
- QString href = static_cast<DOM::Element>(node).getAttribute("href").string();
+ TQString href = static_cast<DOM::Element>(node).getAttribute("href").string();
if(!href.isEmpty() && KURL::isRelativeURL(href)) {
// interpet url relative to document url
u = KURL(Kernel::self()->URL(), href);
@@ -292,7 +292,7 @@ void EntryView::slotOpenURL(const KURL& url_) {
void EntryView::slotReloadEntry() {
// this slot should only be connected in setXSLTFile()
// must disconnect the signal first, otherwise, get an infinite loop
- disconnect(SIGNAL(completed()));
+ disconnect(TQT_SIGNAL(completed()));
closeURL(); // this is needed to stop everything, for some reason
view()->setUpdatesEnabled(true);
@@ -309,12 +309,12 @@ void EntryView::slotReloadEntry() {
void EntryView::setXSLTOptions(const StyleOptions& opt_) {
m_handler->addStringParam("font", opt_.fontFamily.latin1());
- m_handler->addStringParam("fontsize", QCString().setNum(opt_.fontSize));
- m_handler->addStringParam("bgcolor", opt_.baseColor.name().latin1());
- m_handler->addStringParam("fgcolor", opt_.textColor.name().latin1());
- m_handler->addStringParam("color1", opt_.highlightedTextColor.name().latin1());
- m_handler->addStringParam("color2", opt_.highlightedBaseColor.name().latin1());
- m_handler->addStringParam("imgdir", QFile::encodeName(opt_.imgDir));
+ m_handler->addStringParam("fontsize", TQCString().setNum(opt_.fontSize));
+ m_handler->addStringParam("bgcolor", TQString(opt_.baseColor.name()).latin1());
+ m_handler->addStringParam("fgcolor", TQString(opt_.textColor.name()).latin1());
+ m_handler->addStringParam("color1", TQString(opt_.highlightedTextColor.name()).latin1());
+ m_handler->addStringParam("color2", TQString(opt_.highlightedBaseColor.name()).latin1());
+ m_handler->addStringParam("imgdir", TQFile::encodeName(opt_.imgDir));
}
@@ -329,7 +329,7 @@ void EntryView::slotResetColors() {
void EntryView::resetColors() {
ImageFactory::createStyleImages(); // recreate gradients
- QString dir = m_handler ? m_handler->param("imgdir") : QString();
+ TQString dir = m_handler ? m_handler->param("imgdir") : TQString();
if(dir.isEmpty()) {
dir = Data::Document::self()->allImagesOnDisk() ? ImageFactory::dataDir() : ImageFactory::tempDir();
} else {
@@ -340,10 +340,10 @@ void EntryView::resetColors() {
// this is a rather bad hack to get around the fact that the image cache is not reloaded when
// the gradient files are changed on disk. Setting the URLArgs for write() calls doesn't seem to
- // work. So force a reload with a temp file, then catch the completed signal and repaint
- QString s = QString::fromLatin1("<html><body><img src=\"%1\"><img src=\"%2\"></body></html>")
- .arg(dir + QString::fromLatin1("gradient_bg.png"))
- .arg(dir + QString::fromLatin1("gradient_header.png"));
+ // work. So force a reload with a temp file, then catch the completed signal and tqrepaint
+ TQString s = TQString::tqfromLatin1("<html><body><img src=\"%1\"><img src=\"%2\"></body></html>")
+ .tqarg(dir + TQString::tqfromLatin1("gradient_bg.png"))
+ .tqarg(dir + TQString::tqfromLatin1("gradient_header.png"));
delete m_tempFile;
m_tempFile = new KTempFile;
@@ -358,7 +358,7 @@ void EntryView::resetColors() {
// don't flicker
view()->setUpdatesEnabled(false);
openURL(m_tempFile->name());
- connect(this, SIGNAL(completed()), SLOT(slotReloadEntry()));
+ connect(this, TQT_SIGNAL(completed()), TQT_SLOT(slotReloadEntry()));
}
#include "entryview.moc"