diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/plugins/queries/kexiquerydesignersqlhistory.cpp | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/plugins/queries/kexiquerydesignersqlhistory.cpp')
-rw-r--r-- | kexi/plugins/queries/kexiquerydesignersqlhistory.cpp | 166 |
1 files changed, 83 insertions, 83 deletions
diff --git a/kexi/plugins/queries/kexiquerydesignersqlhistory.cpp b/kexi/plugins/queries/kexiquerydesignersqlhistory.cpp index d86caf83..19c0e06a 100644 --- a/kexi/plugins/queries/kexiquerydesignersqlhistory.cpp +++ b/kexi/plugins/queries/kexiquerydesignersqlhistory.cpp @@ -18,9 +18,9 @@ * Boston, MA 02110-1301, USA. */ -#include <qpainter.h> -#include <qclipboard.h> -#include <qregexp.h> +#include <tqpainter.h> +#include <tqclipboard.h> +#include <tqregexp.h> #include <kpopupmenu.h> #include <klocale.h> @@ -31,8 +31,8 @@ #include "kexiquerydesignersqlhistory.h" -KexiQueryDesignerSQLHistory::KexiQueryDesignerSQLHistory(QWidget *parent, const char *name) - : QScrollView(parent, name) +KexiQueryDesignerSQLHistory::KexiQueryDesignerSQLHistory(TQWidget *tqparent, const char *name) + : TQScrollView(tqparent, name) { viewport()->setPaletteBackgroundColor(white); @@ -41,7 +41,7 @@ KexiQueryDesignerSQLHistory::KexiQueryDesignerSQLHistory(QWidget *parent, const m_history->setAutoDelete(true); m_popup = new KPopupMenu(this); - m_popup->insertItem(SmallIcon("editcopy"), i18n("Copy to Clipboard"), this, SLOT(slotToClipboard())); + m_popup->insertItem(SmallIcon("editcopy"), i18n("Copy to Clipboard"), this, TQT_SLOT(slotToClipboard())); } KexiQueryDesignerSQLHistory::~KexiQueryDesignerSQLHistory() @@ -49,65 +49,65 @@ KexiQueryDesignerSQLHistory::~KexiQueryDesignerSQLHistory() } void -KexiQueryDesignerSQLHistory::drawContents(QPainter *p, int cx, int cy, int cw, int ch) +KexiQueryDesignerSQLHistory::drawContents(TQPainter *p, int cx, int cy, int cw, int ch) { - QRect clipping(cx, cy, cw, ch); + TQRect clipping(cx, cy, cw, ch); int y = 0; for(HistoryEntry *it = m_history->first(); it; it = m_history->next()) { // it->drawItem(p, visibleWidth()); - if(clipping.intersects(it->geometry(y, visibleWidth(), fontMetrics()))) + if(clipping.intersects(it->tqgeometry(y, visibleWidth(), fontMetrics()))) { p->saveWorldMatrix(); p->translate(0, y); - it->drawItem(p, visibleWidth(), colorGroup()); + it->drawItem(p, visibleWidth(), tqcolorGroup()); p->restoreWorldMatrix(); } - y += it->geometry(y, visibleWidth(), fontMetrics()).height() + 5; + y += it->tqgeometry(y, visibleWidth(), fontMetrics()).height() + 5; } } void -KexiQueryDesignerSQLHistory::contentsMousePressEvent(QMouseEvent * e) +KexiQueryDesignerSQLHistory::contentsMousePressEvent(TQMouseEvent * e) { int y = 0; HistoryEntry *popupHistory = 0; int pos; - for(QPtrListIterator<HistoryEntry> it(*m_history); it.current(); ++it) + for(TQPtrListIterator<HistoryEntry> it(*m_history); it.current(); ++it) { if(it.current()->isSelected()) { //clear - it.current()->setSelected(false, colorGroup()); - updateContents(it.current()->geometry(y, visibleWidth(), fontMetrics())); + it.current()->setSelected(false, tqcolorGroup()); + updateContents(it.current()->tqgeometry(y, visibleWidth(), fontMetrics())); } - if(it.current()->geometry(y, visibleWidth(), fontMetrics()).contains(e->pos())) + if(it.current()->tqgeometry(y, visibleWidth(), fontMetrics()).tqcontains(e->pos())) { popupHistory = it.current(); pos = y; } - y += it.current()->geometry(y, visibleWidth(), fontMetrics()).height() + 5; + y += it.current()->tqgeometry(y, visibleWidth(), fontMetrics()).height() + 5; } //now do update if (popupHistory) { if (m_selected && m_selected != popupHistory) { - m_selected->setSelected(false, colorGroup()); - updateContents(m_selected->geometry(pos, visibleWidth(), fontMetrics())); + m_selected->setSelected(false, tqcolorGroup()); + updateContents(m_selected->tqgeometry(pos, visibleWidth(), fontMetrics())); } m_selected = popupHistory; - m_selected->setSelected(true, colorGroup()); - updateContents(m_selected->geometry(pos, visibleWidth(), fontMetrics())); - if(e->button() == RightButton) { + m_selected->setSelected(true, tqcolorGroup()); + updateContents(m_selected->tqgeometry(pos, visibleWidth(), fontMetrics())); + if(e->button() == Qt::RightButton) { m_popup->exec(e->globalPos()); } } } void -KexiQueryDesignerSQLHistory::contentsMouseDoubleClickEvent(QMouseEvent * e) +KexiQueryDesignerSQLHistory::contentsMouseDoubleClickEvent(TQMouseEvent * e) { contentsMousePressEvent(e); if (m_selected) @@ -115,17 +115,17 @@ KexiQueryDesignerSQLHistory::contentsMouseDoubleClickEvent(QMouseEvent * e) } void -KexiQueryDesignerSQLHistory::addEvent(const QString& q, bool s, const QString &error) +KexiQueryDesignerSQLHistory::addEvent(const TQString& q, bool s, const TQString &error) { HistoryEntry *he=m_history->last(); if (he) { if (he->statement()==q) { - he->updateTime(QTime::currentTime()); - repaint(); + he->updateTime(TQTime::currentTime()); + tqrepaint(); return; } } - addEntry(new HistoryEntry(s, QTime::currentTime(), q, error)); + addEntry(new HistoryEntry(s, TQTime::currentTime(), q, error)); } void @@ -137,37 +137,37 @@ KexiQueryDesignerSQLHistory::addEntry(HistoryEntry *e) int y = 0; for(HistoryEntry *it = m_history->first(); it; it = m_history->next()) { - y += it->geometry(y, visibleWidth(), fontMetrics()).height() + 5; + y += it->tqgeometry(y, visibleWidth(), fontMetrics()).height() + 5; } resizeContents(visibleWidth() - 1, y); if (m_selected) { - m_selected->setSelected(false, colorGroup()); + m_selected->setSelected(false, tqcolorGroup()); } m_selected = e; - m_selected->setSelected(true, colorGroup()); + m_selected->setSelected(true, tqcolorGroup()); ensureVisible(0,y+5); updateContents(); /* ensureVisible(0, 0); if (m_selected) { - m_selected->setSelected(false, colorGroup()); + m_selected->setSelected(false, tqcolorGroup()); } m_selected = e; - m_selected->setSelected(true, colorGroup()); + m_selected->setSelected(true, tqcolorGroup()); // updateContents(); - updateContents(m_selected->geometry(0, visibleWidth(), fontMetrics()));*/ + updateContents(m_selected->tqgeometry(0, visibleWidth(), fontMetrics()));*/ } /*void -KexiQueryDesignerSQLHistory::contextMenu(const QPoint &pos, HistoryEntry *) +KexiQueryDesignerSQLHistory::contextMenu(const TQPoint &pos, HistoryEntry *) { KPopupMenu p(this); - p.insertItem(SmallIcon("editcopy"), i18n("Copy to Clipboard"), this, SLOT(slotToClipboard())); + p.insertItem(SmallIcon("editcopy"), i18n("Copy to Clipboard"), this, TQT_SLOT(slotToClipboard())); #ifndef KEXI_NO_UNFINISHED p.insertSeparator(); - p.insertItem(SmallIcon("edit"), i18n("Edit"), this, SLOT(slotEdit())); + p.insertItem(SmallIcon("edit"), i18n("Edit"), this, TQT_SLOT(slotEdit())); p.insertItem(SmallIcon("reload"), i18n("Requery")); #endif @@ -180,7 +180,7 @@ KexiQueryDesignerSQLHistory::slotToClipboard() if(!m_selected) return; - QApplication::clipboard()->setText(m_selected->statement(), QClipboard::Clipboard); + TQApplication::tqclipboard()->setText(m_selected->statement(), TQClipboard::Clipboard); } void @@ -189,10 +189,10 @@ KexiQueryDesignerSQLHistory::slotEdit() emit editRequested(m_selected->statement()); } -QString +TQString KexiQueryDesignerSQLHistory::selectedStatement() const { - return m_selected ? m_selected->statement() : QString::null; + return m_selected ? m_selected->statement() : TQString(); } void @@ -216,37 +216,37 @@ KPopupMenu* KexiQueryDesignerSQLHistory::popupMenu() const //================================== -HistoryEntry::HistoryEntry(bool succeed, const QTime &execTime, const QString &statement, /*int ,*/ const QString &err) +HistoryEntry::HistoryEntry(bool succeed, const TQTime &execTime, const TQString &statement, /*int ,*/ const TQString &err) { m_succeed = succeed; m_execTime = execTime; m_statement = statement; m_error = err; m_selected = false; - highlight(QColorGroup()); + highlight(TQColorGroup()); } void -HistoryEntry::drawItem(QPainter *p, int width, const QColorGroup &cg) +HistoryEntry::drawItem(TQPainter *p, int width, const TQColorGroup &cg) { - p->setPen(QColor(200, 200, 200)); - p->setBrush(QColor(200, 200, 200)); + p->setPen(TQColor(200, 200, 200)); + p->setBrush(TQColor(200, 200, 200)); p->drawRect(2, 2, 200, 20); - p->setPen(QColor(0, 0, 0)); + p->setPen(TQColor(0, 0, 0)); if(m_succeed) p->drawPixmap(4, 4, SmallIcon("button_ok")); else p->drawPixmap(4, 4, SmallIcon("button_cancel")); - p->drawText(22, 2, 180, 20, Qt::AlignLeft | Qt::AlignVCenter, m_execTime.toString()); - p->setPen(QColor(200, 200, 200)); - p->setBrush(QColor(255, 255, 255)); + p->drawText(22, 2, 180, 20, TQt::AlignLeft | TQt::AlignVCenter, m_execTime.toString()); + p->setPen(TQColor(200, 200, 200)); + p->setBrush(TQColor(255, 255, 255)); m_formated->setWidth(width - 2); - QRect content(2, 21, width - 2, m_formated->height()); -// QRect content = p->fontMetrics().boundingRect(2, 21, width - 2, 0, Qt::WordBreak | Qt::AlignLeft | Qt::AlignVCenter, m_statement); -// QRect content(2, 21, width - 2, p->fontMetrics().height() + 4); -// content = QRect(2, 21, width - 2, m_for.height()); + TQRect content(2, 21, width - 2, m_formated->height()); +// TQRect content = p->fontMetrics().boundingRect(2, 21, width - 2, 0, TQt::WordBreak | TQt::AlignLeft | TQt::AlignVCenter, m_statement); +// TQRect content(2, 21, width - 2, p->fontMetrics().height() + 4); +// content = TQRect(2, 21, width - 2, m_for.height()); if(m_selected) p->setBrush(cg.highlight()); @@ -260,36 +260,36 @@ HistoryEntry::drawItem(QPainter *p, int width, const QColorGroup &cg) content.setX(content.x() + 2); content.setWidth(content.width() - 2); -// p->drawText(content, Qt::WordBreak | Qt::AlignLeft | Qt::AlignVCenter, m_statement); +// p->drawText(content, TQt::WordBreak | TQt::AlignLeft | TQt::AlignVCenter, m_statement); m_formated->draw(p, content.x(), content.y(), content, cg); } void -HistoryEntry::highlight(const QColorGroup &cg) +HistoryEntry::highlight(const TQColorGroup &cg) { - QString statement; - QString text; + TQString statement; + TQString text; bool quote = false; bool dblquote = false; statement = m_statement; - statement.replace("<", "<"); - statement.replace(">", ">"); - statement.replace("\r\n", "<br>"); //(js) first win32 specific pair - statement.replace("\n", "<br>"); // now single \n - statement.replace(" ", " "); - statement.replace("\t", " "); + statement.tqreplace("<", "<"); + statement.tqreplace(">", ">"); + statement.tqreplace("\r\n", "<br>"); //(js) first win32 specific pair + statement.tqreplace("\n", "<br>"); // now single \n + statement.tqreplace(" ", " "); + statement.tqreplace("\t", " "); // getting quoting... if(!m_selected) { for(int i=0; i < (int)statement.length(); i++) { - QString beginTag; - QString endTag; - QChar curr = QChar(statement[i]); + TQString beginTag; + TQString endTag; + TQChar curr = TQChar(statement[i]); - if(curr == "'" && !dblquote && QChar(statement[i-1]) != "\\") + if(TQString(curr) == "'" && !dblquote && TQString(TQChar(statement[i-1])) != "\\") { if(!quote) { @@ -302,7 +302,7 @@ HistoryEntry::highlight(const QColorGroup &cg) endTag += "</font>"; } } - if(curr == "\"" && !quote && QChar(statement[i-1]) != "\\") + if(TQString(curr) == "\"" && !quote && TQString(TQChar(statement[i-1])) != "\\") { if(!dblquote) { @@ -315,7 +315,7 @@ HistoryEntry::highlight(const QColorGroup &cg) endTag += "</font>"; } } - if(QRegExp("[0-9]").exactMatch(QString(curr)) && !quote && !dblquote) + if(TQRegExp("[0-9]").exactMatch(TQString(curr)) && !quote && !dblquote) { beginTag += "<font color=\"#0000ff\">"; endTag += "</font>"; @@ -326,43 +326,43 @@ HistoryEntry::highlight(const QColorGroup &cg) } else { - text = QString("<font color=\"%1\">%2").arg(cg.highlightedText().name()).arg(statement); + text = TQString("<font color=\"%1\">%2").tqarg(cg.highlightedText().name()).tqarg(statement); } - QRegExp keywords("\\b(SELECT|UPDATE|INSERT|DELETE|DROP|FROM|WHERE|AND|OR|NOT|NULL|JOIN|LEFT|RIGHT|ON|INTO|TABLE)\\b"); + TQRegExp keywords("\\b(SELECT|UPDATE|INSERT|DELETE|DROP|FROM|WHERE|AND|OR|NOT|NULL|JOIN|LEFT|RIGHT|ON|INTO|TABLE)\\b"); keywords.setCaseSensitive(false); - text = text.replace(keywords, "<b>\\1</b>"); + text = text.tqreplace(keywords, "<b>\\1</b>"); if(!m_error.isEmpty()) -// text += ("<br>"+i18n("Error: %1").arg(m_error)); -// text += QString("<br><font face=\"") + KGlobalSettings::generalFont().family() + QString("\" size=\"-1\">") + i18n("Error: %1").arg(m_error) + "</font>"; - text += QString("<br><font face=\"") + KGlobalSettings::generalFont().family() + QString("\">") + i18n("Error: %1").arg(m_error) + "</font>"; +// text += ("<br>"+i18n("Error: %1").tqarg(m_error)); +// text += TQString("<br><font face=\"") + KGlobalSettings::generalFont().family() + TQString("\" size=\"-1\">") + i18n("Error: %1").tqarg(m_error) + "</font>"; + text += TQString("<br><font face=\"") + KGlobalSettings::generalFont().family() + TQString("\">") + i18n("Error: %1").tqarg(m_error) + "</font>"; kdDebug() << "HistoryEntry::highlight() text:" << text << endl; -// m_formated = new QSimpleRichText(text, QFont("courier", 8)); - m_formated = new QSimpleRichText(text, KGlobalSettings::fixedFont()); +// m_formated = new TQSimpleRichText(text, TQFont("courier", 8)); + m_formated = new TQSimpleRichText(text, KGlobalSettings::fixedFont()); } void -HistoryEntry::setSelected(bool selected, const QColorGroup &cg) +HistoryEntry::setSelected(bool selected, const TQColorGroup &cg) { m_selected = selected; highlight(cg); } -QRect -HistoryEntry::geometry(int y, int width, QFontMetrics f) +TQRect +HistoryEntry::tqgeometry(int y, int width, TQFontMetrics f) { Q_UNUSED( f ); -// int h = 21 + f.boundingRect(2, 21, width - 2, 0, Qt::WordBreak | Qt::AlignLeft | Qt::AlignVCenter, m_statement).height(); -// return QRect(0, y, width, h); +// int h = 21 + f.boundingRect(2, 21, width - 2, 0, TQt::WordBreak | TQt::AlignLeft | TQt::AlignVCenter, m_statement).height(); +// return TQRect(0, y, width, h); m_formated->setWidth(width - 2); - return QRect(0, y, width, m_formated->height() + 21); + return TQRect(0, y, width, m_formated->height() + 21); } -void HistoryEntry::updateTime(const QTime &execTime) { +void HistoryEntry::updateTime(const TQTime &execTime) { m_execTime=execTime; } |