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/kexiquerydesignersql.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/kexiquerydesignersql.cpp')
-rw-r--r-- | kexi/plugins/queries/kexiquerydesignersql.cpp | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/kexi/plugins/queries/kexiquerydesignersql.cpp b/kexi/plugins/queries/kexiquerydesignersql.cpp index 469d551c..36455837 100644 --- a/kexi/plugins/queries/kexiquerydesignersql.cpp +++ b/kexi/plugins/queries/kexiquerydesignersql.cpp @@ -18,11 +18,11 @@ * Boston, MA 02110-1301, USA. */ -#include <qsplitter.h> -#include <qlayout.h> -#include <qhbox.h> -#include <qvbox.h> -#include <qtimer.h> +#include <tqsplitter.h> +#include <tqlayout.h> +#include <tqhbox.h> +#include <tqvbox.h> +#include <tqtimer.h> #include <kapplication.h> #include <kdebug.h> @@ -45,7 +45,7 @@ #include "kexisectionheader.h" -static bool compareSQL(const QString& sql1, const QString& sql2) +static bool compareSQL(const TQString& sql1, const TQString& sql2) { //TODO: use reformatting functions here return sql1.stripWhiteSpace()==sql2.stripWhiteSpace(); @@ -73,18 +73,18 @@ class KexiQueryDesignerSQLView::Private } KexiQueryDesignerSQLEditor *editor; KexiQueryDesignerSQLHistory *history; - QLabel *pixmapStatus, *lblStatus; - QHBox *status_hbox; - QVBox *history_section; + TQLabel *pixmaptqStatus, *lbltqStatus; + TQHBox *status_hbox; + TQVBox *history_section; KexiSectionHeader *head, *historyHead; - QPixmap statusPixmapOk, statusPixmapErr, statusPixmapInfo; - QSplitter *splitter; + TQPixmap statusPixmapOk, statusPixmapErr, statusPixmapInfo; + TQSplitter *splitter; KToggleAction *action_toggle_history; //! For internal use, this pointer is usually copied to TempData structure, //! when switching out of this view (then it's cleared). KexiDB::QuerySchema *parsedQuery; //! For internal use, statement passed in switching to this view - QString origStatement; + TQString origStatement; //! needed to remember height for both modes, between switching int heightForStatusMode, heightForHistoryMode; //! helper for slotUpdateMode() @@ -99,58 +99,58 @@ class KexiQueryDesignerSQLView::Private //=================== -KexiQueryDesignerSQLView::KexiQueryDesignerSQLView(KexiMainWindow *mainWin, QWidget *parent, const char *name) - : KexiViewBase(mainWin, parent, name) +KexiQueryDesignerSQLView::KexiQueryDesignerSQLView(KexiMainWindow *mainWin, TQWidget *tqparent, const char *name) + : KexiViewBase(mainWin, tqparent, name) , d( new Private() ) { - d->splitter = new QSplitter(this); - d->splitter->setOrientation(Vertical); - d->head = new KexiSectionHeader(i18n("SQL Query Text"), Vertical, d->splitter); + d->splitter = new TQSplitter(this); + d->splitter->setOrientation(Qt::Vertical); + d->head = new KexiSectionHeader(i18n("SQL Query Text"),Qt::Vertical, d->splitter); d->editor = new KexiQueryDesignerSQLEditor(mainWin, d->head, "sqle"); // d->editor->installEventFilter(this);//for keys - connect(d->editor, SIGNAL(textChanged()), this, SLOT(slotTextChanged())); + connect(d->editor, TQT_SIGNAL(textChanged()), TQT_TQOBJECT(this), TQT_SLOT(slotTextChanged())); addChildView(d->editor); setViewWidget(d->editor); d->splitter->setFocusProxy(d->editor); setFocusProxy(d->editor); - d->history_section = new QVBox(d->splitter); + d->history_section = new TQVBox(d->splitter); - d->status_hbox = new QHBox(d->history_section); + d->status_hbox = new TQHBox(d->history_section); d->status_hbox->installEventFilter(this); - d->splitter->setResizeMode(d->history_section, QSplitter::KeepSize); + d->splitter->setResizeMode(d->history_section, TQSplitter::KeepSize); d->status_hbox->setSpacing(0); - d->pixmapStatus = new QLabel(d->status_hbox); - d->pixmapStatus->setFixedWidth(d->statusPixmapOk.width()*3/2); - d->pixmapStatus->setAlignment(AlignHCenter | AlignTop); - d->pixmapStatus->setMargin(d->statusPixmapOk.width()/4); - d->pixmapStatus->setPaletteBackgroundColor( palette().active().color(QColorGroup::Base) ); - - d->lblStatus = new QLabel(d->status_hbox); - d->lblStatus->setAlignment(AlignLeft | AlignTop | WordBreak); - d->lblStatus->setMargin(d->statusPixmapOk.width()/4); - d->lblStatus->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding ); - d->lblStatus->resize(d->lblStatus->width(),d->statusPixmapOk.width()*3); - d->lblStatus->setPaletteBackgroundColor( palette().active().color(QColorGroup::Base) ); - - QHBoxLayout *b = new QHBoxLayout(this); + d->pixmaptqStatus = new TQLabel(d->status_hbox); + d->pixmaptqStatus->setFixedWidth(d->statusPixmapOk.width()*3/2); + d->pixmaptqStatus->tqsetAlignment(AlignHCenter | AlignTop); + d->pixmaptqStatus->setMargin(d->statusPixmapOk.width()/4); + d->pixmaptqStatus->setPaletteBackgroundColor( tqpalette().active().color(TQColorGroup::Base) ); + + d->lbltqStatus = new TQLabel(d->status_hbox); + d->lbltqStatus->tqsetAlignment(AlignLeft | AlignTop | WordBreak); + d->lbltqStatus->setMargin(d->statusPixmapOk.width()/4); + d->lbltqStatus->tqsetSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Expanding ); + d->lbltqStatus->resize(d->lbltqStatus->width(),d->statusPixmapOk.width()*3); + d->lbltqStatus->setPaletteBackgroundColor( tqpalette().active().color(TQColorGroup::Base) ); + + TQHBoxLayout *b = new TQHBoxLayout(this); b->addWidget(d->splitter); - plugSharedAction("querypart_check_query", this, SLOT(slotCheckQuery())); - plugSharedAction("querypart_view_toggle_history", this, SLOT(slotUpdateMode())); + plugSharedAction("querypart_check_query", TQT_TQOBJECT(this), TQT_SLOT(slotCheckQuery())); + plugSharedAction("querypart_view_toggle_history", TQT_TQOBJECT(this), TQT_SLOT(slotUpdateMode())); d->action_toggle_history = static_cast<KToggleAction*>( sharedAction( "querypart_view_toggle_history" ) ); - d->historyHead = new KexiSectionHeader(i18n("SQL Query History"), Vertical, d->history_section); + d->historyHead = new KexiSectionHeader(i18n("SQL Query History"),Qt::Vertical, d->history_section); d->historyHead->installEventFilter(this); d->history = new KexiQueryDesignerSQLHistory(d->historyHead, "sql_history"); - static const QString msg_back = i18n("Back to Selected Query"); - static const QString msg_clear = i18n("Clear History"); - d->historyHead->addButton("select_item", msg_back, this, SLOT(slotSelectQuery())); - d->historyHead->addButton("editclear", msg_clear, d->history, SLOT(clear())); - d->history->popupMenu()->insertItem(SmallIcon("select_item"), msg_back, this, SLOT(slotSelectQuery())); - d->history->popupMenu()->insertItem(SmallIcon("editclear"), msg_clear, d->history, SLOT(clear())); - connect(d->history, SIGNAL(currentItemDoubleClicked()), this, SLOT(slotSelectQuery())); + static const TQString msg_back = i18n("Back to Selected Query"); + static const TQString msg_clear = i18n("Clear History"); + d->historyHead->addButton("select_item", msg_back, TQT_TQOBJECT(this), TQT_SLOT(slotSelectQuery())); + d->historyHead->addButton("editclear", msg_clear, TQT_TQOBJECT(d->history), TQT_SLOT(clear())); + d->history->popupMenu()->insertItem(SmallIcon("select_item"), msg_back, TQT_TQOBJECT(this), TQT_SLOT(slotSelectQuery())); + d->history->popupMenu()->insertItem(SmallIcon("editclear"), msg_clear, d->history, TQT_SLOT(clear())); + connect(d->history, TQT_SIGNAL(currentItemDoubleClicked()), TQT_TQOBJECT(this), TQT_SLOT(slotSelectQuery())); d->heightForHistoryMode = -1; //height() / 2; //d->historyHead->hide(); @@ -171,36 +171,36 @@ KexiQueryDesignerSQLEditor *KexiQueryDesignerSQLView::editor() const void KexiQueryDesignerSQLView::setStatusOk() { - d->pixmapStatus->setPixmap(d->statusPixmapOk); + d->pixmaptqStatus->setPixmap(d->statusPixmapOk); setStatusText("<h2>"+i18n("The query is correct")+"</h2>"); - d->history->addEvent(d->editor->text().stripWhiteSpace(), true, QString::null); + d->history->addEvent(d->editor->text().stripWhiteSpace(), true, TQString()); } -void KexiQueryDesignerSQLView::setStatusError(const QString& msg) +void KexiQueryDesignerSQLView::setStatusError(const TQString& msg) { - d->pixmapStatus->setPixmap(d->statusPixmapErr); + d->pixmaptqStatus->setPixmap(d->statusPixmapErr); setStatusText("<h2>"+i18n("The query is incorrect")+"</h2><p>"+msg+"</p>"); d->history->addEvent(d->editor->text().stripWhiteSpace(), false, msg); } void KexiQueryDesignerSQLView::setStatusEmpty() { - d->pixmapStatus->setPixmap(d->statusPixmapInfo); + d->pixmaptqStatus->setPixmap(d->statusPixmapInfo); setStatusText(i18n("Please enter your query and execute \"Check query\" function to verify it.")); } -void KexiQueryDesignerSQLView::setStatusText(const QString& text) +void KexiQueryDesignerSQLView::setStatusText(const TQString& text) { if (!d->action_toggle_history->isChecked()) { - QSimpleRichText rt(text, d->lblStatus->font()); - rt.setWidth(d->lblStatus->width()); - QValueList<int> sz = d->splitter->sizes(); - const int newHeight = rt.height()+d->lblStatus->margin()*2; + TQSimpleRichText rt(text, d->lbltqStatus->font()); + rt.setWidth(d->lbltqStatus->width()); + TQValueList<int> sz = d->splitter->sizes(); + const int newHeight = rt.height()+d->lbltqStatus->margin()*2; if (sz[1]<newHeight) { sz[1] = newHeight; d->splitter->setSizes(sz); } - d->lblStatus->setText(text); + d->lbltqStatus->setText(text); } } @@ -210,7 +210,7 @@ KexiQueryDesignerSQLView::beforeSwitchTo(int mode, bool &dontStore) //TODO dontStore = true; if (mode==Kexi::DesignViewMode || mode==Kexi::DataViewMode) { - QString sqlText = d->editor->text().stripWhiteSpace(); + TQString sqlText = d->editor->text().stripWhiteSpace(); KexiQueryPart::TempData * temp = tempData(); if (sqlText.isEmpty()) { //special case: empty SQL text @@ -222,7 +222,7 @@ KexiQueryDesignerSQLView::beforeSwitchTo(int mode, bool &dontStore) } } else { - const bool designViewWasVisible = parentDialog()->viewForMode(mode)!=0; + const bool designViewWasVisible = tqparentDialog()->viewForMode(mode)!=0; //should we check SQL text? if (designViewWasVisible && !d->justSwitchedFromNoViewMode //unchanged, but we should check SQL text @@ -274,7 +274,7 @@ KexiQueryDesignerSQLView::beforeSwitchTo(int mode, bool &dontStore) } setDirty(true);*/ -// if (parentDialog()->hasFocus()) +// if (tqparentDialog()->hasFocus()) d->editor->setFocus(); return true; } @@ -287,13 +287,13 @@ KexiQueryDesignerSQLView::afterSwitchFrom(int mode) if (mode==Kexi::NoViewMode) { //User opened text view _directly_. //This flag is set to indicate for beforeSwitchTo() that even if text has not been changed, - //SQL text should be invalidated. + //SQL text should be tqinvalidated. d->justSwitchedFromNoViewMode = true; } KexiQueryPart::TempData * temp = tempData(); KexiDB::QuerySchema *query = temp->query(); if (!query) {//try to just get saved schema, instead of temporary one - query = dynamic_cast<KexiDB::QuerySchema *>(parentDialog()->schemaData()); + query = dynamic_cast<KexiDB::QuerySchema *>(tqparentDialog()->schemaData()); } if (mode!=0/*failure only if it is switching from prev. view*/ && !query) { @@ -320,11 +320,11 @@ KexiQueryDesignerSQLView::afterSwitchFrom(int mode) d->slotTextChangedEnabled = false; d->editor->setText( d->origStatement ); d->slotTextChangedEnabled = true; - QTimer::singleShot(100, d->editor, SLOT(setFocus())); + TQTimer::singleShot(100, d->editor, TQT_SLOT(setFocus())); return true; } -QString +TQString KexiQueryDesignerSQLView::sqlText() const { return d->editor->text(); @@ -332,7 +332,7 @@ KexiQueryDesignerSQLView::sqlText() const bool KexiQueryDesignerSQLView::slotCheckQuery() { - QString sqlText( d->editor->text().stripWhiteSpace() ); + TQString sqlText( d->editor->text().stripWhiteSpace() ); if (sqlText.isEmpty()) { delete d->parsedQuery; d->parsedQuery = 0; @@ -366,7 +366,7 @@ void KexiQueryDesignerSQLView::slotUpdateMode() d->eventFilterForSplitterEnabled = false; - QValueList<int> sz = d->splitter->sizes(); + TQValueList<int> sz = d->splitter->sizes(); d->action_toggle_history_was_checked = d->action_toggle_history->isChecked(); int heightToSet = -1; if (d->action_toggle_history->isChecked()) { @@ -407,13 +407,13 @@ void KexiQueryDesignerSQLView::slotTextChanged() setStatusEmpty(); } -bool KexiQueryDesignerSQLView::eventFilter( QObject *o, QEvent *e ) +bool KexiQueryDesignerSQLView::eventFilter( TQObject *o, TQEvent *e ) { if (d->eventFilterForSplitterEnabled) { - if (e->type()==QEvent::Resize && o && o==d->historyHead && d->historyHead->isVisible()) { + if (e->type()==TQEvent::Resize && o && TQT_BASE_OBJECT(o)==TQT_BASE_OBJECT(d->historyHead) && d->historyHead->isVisible()) { d->heightForHistoryMode = d->historyHead->height(); } - else if (e->type()==QEvent::Resize && o && o==d->status_hbox && d->status_hbox->isVisible()) { + else if (e->type()==TQEvent::Resize && o && TQT_BASE_OBJECT(o)==TQT_BASE_OBJECT(d->status_hbox) && d->status_hbox->isVisible()) { d->heightForStatusMode = d->status_hbox->height(); } } @@ -432,7 +432,7 @@ void KexiQueryDesignerSQLView::updateActions(bool activated) void KexiQueryDesignerSQLView::slotSelectQuery() { - QString sql = d->history->selectedStatement(); + TQString sql = d->history->selectedStatement(); if (!sql.isEmpty()) { d->editor->setText( sql ); } @@ -441,7 +441,7 @@ void KexiQueryDesignerSQLView::slotSelectQuery() KexiQueryPart::TempData * KexiQueryDesignerSQLView::tempData() const { - return dynamic_cast<KexiQueryPart::TempData*>(parentDialog()->tempData()); + return dynamic_cast<KexiQueryPart::TempData*>(tqparentDialog()->tempData()); } KexiDB::SchemaData* @@ -449,7 +449,7 @@ KexiQueryDesignerSQLView::storeNewData(const KexiDB::SchemaData& sdata, bool &ca { Q_UNUSED( cancel ); - //here: we won't store query layout: it will be recreated 'by hand' in GUI Query Editor + //here: we won't store query tqlayout: it will be recreated 'by hand' in GUI Query Editor bool queryOK = slotCheckQuery(); bool ok = true; KexiDB::SchemaData* query = 0; @@ -519,7 +519,7 @@ tristate KexiQueryDesignerSQLView::storeData(bool dontAsk) #endif } if (res == true) { - QString empty_xml; + TQString empty_xml; res = storeDataBlock( empty_xml, "query_layout" ); //clear } if (!res) @@ -528,7 +528,7 @@ tristate KexiQueryDesignerSQLView::storeData(bool dontAsk) } -/*void KexiQueryDesignerSQLView::slotHistoryHeaderButtonClicked(const QString& buttonIdentifier) +/*void KexiQueryDesignerSQLView::slotHistoryHeaderButtonClicked(const TQString& buttonIdentifier) { if (buttonIdentifier=="select_query") { slotSelectQuery(); |