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/widget/relations/kexirelationwidget.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/widget/relations/kexirelationwidget.cpp')
-rw-r--r-- | kexi/widget/relations/kexirelationwidget.cpp | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/kexi/widget/relations/kexirelationwidget.cpp b/kexi/widget/relations/kexirelationwidget.cpp index 14ec4ce0..7ef5a961 100644 --- a/kexi/widget/relations/kexirelationwidget.cpp +++ b/kexi/widget/relations/kexirelationwidget.cpp @@ -21,10 +21,10 @@ #include "kexirelationwidget.h" -#include <qlayout.h> -#include <qlistbox.h> -#include <qpushbutton.h> -#include <qtimer.h> +#include <tqlayout.h> +#include <tqlistbox.h> +#include <tqpushbutton.h> +#include <tqtimer.h> #include <kcombobox.h> #include <klocale.h> @@ -41,31 +41,31 @@ #include "kexirelationviewtable.h" #include "kexirelationviewconnection.h" -KexiRelationWidget::KexiRelationWidget(KexiMainWindow *win, QWidget *parent, +KexiRelationWidget::KexiRelationWidget(KexiMainWindow *win, TQWidget *tqparent, const char *name) - : KexiViewBase(win, parent, name) + : KexiViewBase(win, tqparent, name) , m_win(win) { m_conn = m_win->project()->dbConnection(); - QHBoxLayout *hlyr = new QHBoxLayout(0); - QGridLayout *g = new QGridLayout(this); + TQHBoxLayout *hlyr = new TQHBoxLayout(0); + TQGridLayout *g = new TQGridLayout(this); g->addLayout( hlyr, 0, 0 ); m_tableCombo = new KComboBox(this, "tables_combo"); - m_tableCombo->setMinimumWidth(QFontMetrics(font()).width("w")*20); - QLabel *lbl = new QLabel(m_tableCombo, i18n("Table")+": ", this); + m_tableCombo->setMinimumWidth(TQFontMetrics(font()).width("w")*20); + TQLabel *lbl = new TQLabel(m_tableCombo, i18n("Table")+": ", this); lbl->setIndent(3); - m_tableCombo->setInsertionPolicy(QComboBox::NoInsertion); + m_tableCombo->setInsertionPolicy(TQComboBox::NoInsertion); hlyr->addWidget(lbl); hlyr->addWidget(m_tableCombo); - m_tableCombo->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred)); + m_tableCombo->tqsetSizePolicy(TQSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::Preferred)); fillTablesCombo(); m_btnAdd = new KPushButton(i18n("&Add"), this); hlyr->addWidget(m_btnAdd); hlyr->addStretch(1); - connect(m_btnAdd, SIGNAL(clicked()), this, SLOT(slotAddTable())); + connect(m_btnAdd, TQT_SIGNAL(clicked()), TQT_TQOBJECT(this), TQT_SLOT(slotAddTable())); m_relationView = new KexiRelationView(this, "relation_view"); setViewWidget(m_relationView); @@ -75,50 +75,50 @@ KexiRelationWidget::KexiRelationWidget(KexiMainWindow *win, QWidget *parent, //actions m_tableQueryPopup = new KPopupMenu(this, "m_popup"); m_tableQueryPopupTitleID = m_tableQueryPopup->insertTitle(SmallIcon("table"), ""); - connect(m_tableQueryPopup, SIGNAL(aboutToShow()), this, SLOT(aboutToShowPopupMenu())); + connect(m_tableQueryPopup, TQT_SIGNAL(aboutToShow()), TQT_TQOBJECT(this), TQT_SLOT(aboutToShowPopupMenu())); m_connectionPopup = new KPopupMenu(this, "m_connectionPopup"); m_connectionPopupTitleID = m_connectionPopup->insertTitle(""); - connect(m_connectionPopup, SIGNAL(aboutToShow()), this, SLOT(aboutToShowPopupMenu())); + connect(m_connectionPopup, TQT_SIGNAL(aboutToShow()), TQT_TQOBJECT(this), TQT_SLOT(aboutToShowPopupMenu())); m_areaPopup = new KPopupMenu(this, "m_areaPopup"); m_openSelectedTableAction = new KAction(i18n("&Open Table"), SmallIcon("fileopen"), KShortcut(), - this, SLOT(openSelectedTable()), this, "relationsview_openTable"); + TQT_TQOBJECT(this), TQT_SLOT(openSelectedTable()), TQT_TQOBJECT(this), "relationsview_openTable"); m_openSelectedTableAction->plug( m_tableQueryPopup ); m_designSelectedTableAction = new KAction(i18n("&Design Table"), SmallIcon("edit"), KShortcut(), - this, SLOT(designSelectedTable()), this, "relationsview_designTable"); + TQT_TQOBJECT(this), TQT_SLOT(designSelectedTable()), TQT_TQOBJECT(this), "relationsview_designTable"); m_designSelectedTableAction->plug( m_tableQueryPopup ); m_tableQueryPopup->insertSeparator(); KAction* hide_action = plugSharedAction("edit_delete", i18n("&Hide Table"), m_tableQueryPopup); - hide_action->setIconSet(QIconSet()); + hide_action->setIconSet(TQIconSet()); plugSharedAction("edit_delete",m_connectionPopup); - plugSharedAction("edit_delete",this, SLOT(removeSelectedObject())); - - connect(m_relationView, SIGNAL(tableViewGotFocus()), - this, SLOT(tableViewGotFocus())); - connect(m_relationView, SIGNAL(connectionViewGotFocus()), - this, SLOT(connectionViewGotFocus())); - connect(m_relationView, SIGNAL(emptyAreaGotFocus()), - this, SLOT(emptyAreaGotFocus())); - connect(m_relationView, SIGNAL(tableContextMenuRequest( const QPoint& )), - this, SLOT(tableContextMenuRequest( const QPoint& ))); - connect(m_relationView, SIGNAL(connectionContextMenuRequest( const QPoint& )), - this, SLOT(connectionContextMenuRequest( const QPoint& ))); - connect(m_relationView, SIGNAL(tableHidden(KexiDB::TableSchema&)), - this, SLOT(slotTableHidden(KexiDB::TableSchema&))); - connect(m_relationView, SIGNAL(tablePositionChanged(KexiRelationViewTableContainer*)), - this, SIGNAL(tablePositionChanged(KexiRelationViewTableContainer*))); - connect(m_relationView, SIGNAL(aboutConnectionRemove(KexiRelationViewConnection*)), - this, SIGNAL(aboutConnectionRemove(KexiRelationViewConnection*))); + plugSharedAction("edit_delete",TQT_TQOBJECT(this), TQT_SLOT(removeSelectedObject())); + + connect(m_relationView, TQT_SIGNAL(tableViewGotFocus()), + TQT_TQOBJECT(this), TQT_SLOT(tableViewGotFocus())); + connect(m_relationView, TQT_SIGNAL(connectionViewGotFocus()), + TQT_TQOBJECT(this), TQT_SLOT(connectionViewGotFocus())); + connect(m_relationView, TQT_SIGNAL(emptyAreaGotFocus()), + TQT_TQOBJECT(this), TQT_SLOT(emptyAreaGotFocus())); + connect(m_relationView, TQT_SIGNAL(tableContextMenuRequest( const TQPoint& )), + TQT_TQOBJECT(this), TQT_SLOT(tableContextMenuRequest( const TQPoint& ))); + connect(m_relationView, TQT_SIGNAL(connectionContextMenuRequest( const TQPoint& )), + TQT_TQOBJECT(this), TQT_SLOT(connectionContextMenuRequest( const TQPoint& ))); + connect(m_relationView, TQT_SIGNAL(tableHidden(KexiDB::TableSchema&)), + TQT_TQOBJECT(this), TQT_SLOT(slotTableHidden(KexiDB::TableSchema&))); + connect(m_relationView, TQT_SIGNAL(tablePositionChanged(KexiRelationViewTableContainer*)), + TQT_TQOBJECT(this), TQT_SIGNAL(tablePositionChanged(KexiRelationViewTableContainer*))); + connect(m_relationView, TQT_SIGNAL(aboutConnectionRemove(KexiRelationViewConnection*)), + TQT_TQOBJECT(this), TQT_SIGNAL(aboutConnectionRemove(KexiRelationViewConnection*))); #if 0 if(!embedd) { /*todo setContextHelp(i18n("Relations"), i18n("To create a relationship simply drag the source field onto the target field. " - "An arrowhead is used to show which table is the parent (master) and which table is the child (slave) in the relationship."));*/ + "An arrowhead is used to show which table is the tqparent (master) and which table is the child (slave) in the relationship."));*/ } #endif // else @@ -126,10 +126,10 @@ KexiRelationWidget::KexiRelationWidget(KexiMainWindow *win, QWidget *parent, #ifdef TESTING_KexiRelationWidget for (int i=0;i<(int)m_db->tableNames().count();i++) - QTimer::singleShot(100,this,SLOT(slotAddTable())); + TQTimer::singleShot(100,this,TQT_SLOT(slotAddTable())); #endif - invalidateActions(); + tqinvalidateActions(); } KexiRelationWidget::~KexiRelationWidget() @@ -141,9 +141,9 @@ TablesDict* KexiRelationWidget::tables() const return m_relationView->tables(); } -KexiRelationViewTableContainer* KexiRelationWidget::table(const QString& name) const +KexiRelationViewTableContainer* KexiRelationWidget::table(const TQString& name) const { - return m_relationView->tables()->find( name ); + return m_relationView->tables()->tqfind( name ); } const ConnectionList* KexiRelationWidget::connections() const @@ -156,13 +156,13 @@ KexiRelationWidget::slotAddTable() { if (m_tableCombo->currentItem()==-1) return; - QString tname = m_tableCombo->text(m_tableCombo->currentItem()); + TQString tname = m_tableCombo->text(m_tableCombo->currentItem()); KexiDB::TableSchema *t = m_conn->tableSchema(tname); addTable(t); } void -KexiRelationWidget::addTable(KexiDB::TableSchema *t, const QRect &rect) +KexiRelationWidget::addTable(KexiDB::TableSchema *t, const TQRect &rect) { if (!t) return; @@ -171,11 +171,11 @@ KexiRelationWidget::addTable(KexiDB::TableSchema *t, const QRect &rect) kdDebug() << "KexiRelationWidget::slotAddTable(): adding table " << t->name() << endl; if (!c) return; - connect(c->tableView(), SIGNAL(doubleClicked(QListViewItem*,const QPoint&,int)), - this, SLOT(slotTableFieldDoubleClicked(QListViewItem*,const QPoint&,int))); + connect(c->tableView(), TQT_SIGNAL(doubleClicked(TQListViewItem*,const TQPoint&,int)), + TQT_TQOBJECT(this), TQT_SLOT(slotTableFieldDoubleClicked(TQListViewItem*,const TQPoint&,int))); } - const QString tname = t->name().lower(); + const TQString tname = t->name().lower(); const int count = m_tableCombo->count(); int i = 0; for (; i < count; i++ ) { @@ -207,7 +207,7 @@ KexiRelationWidget::addConnection(const SourceConnection& conn) } void -KexiRelationWidget::addTable(const QString& t) +KexiRelationWidget::addTable(const TQString& t) { for(int i=0; i < m_tableCombo->count(); i++) { @@ -221,53 +221,53 @@ KexiRelationWidget::addTable(const QString& t) void KexiRelationWidget::tableViewGotFocus() { -// if (m_relationView->focusedTableView == sender()) +// if (m_relationView->focusedTableView == TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))) // return; // kdDebug() << "GOT FOCUS!" <<endl; // clearSelection(); // if (m_focusedTableView) // m_focusedTableView->unsetFocus(); -// m_focusedTableView = (KexiRelationViewTableContainer*)sender(); - invalidateActions(); +// m_focusedTableView = (KexiRelationViewTableContainer*)TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender())); + tqinvalidateActions(); } void KexiRelationWidget::connectionViewGotFocus() { - invalidateActions(); + tqinvalidateActions(); } void KexiRelationWidget::emptyAreaGotFocus() { - invalidateActions(); + tqinvalidateActions(); } -void KexiRelationWidget::tableContextMenuRequest(const QPoint& pos) +void KexiRelationWidget::tableContextMenuRequest(const TQPoint& pos) { - invalidateActions(); + tqinvalidateActions(); executePopup( pos ); } -void KexiRelationWidget::connectionContextMenuRequest(const QPoint& pos) +void KexiRelationWidget::connectionContextMenuRequest(const TQPoint& pos) { - invalidateActions(); + tqinvalidateActions(); executePopup( pos ); // m_connectionPopup->exec(pos); } -void KexiRelationWidget::emptyAreaContextMenuRequest( const QPoint& /*pos*/ ) +void KexiRelationWidget::emptyAreaContextMenuRequest( const TQPoint& /*pos*/ ) { - invalidateActions(); + tqinvalidateActions(); //TODO } -void KexiRelationWidget::invalidateActions() +void KexiRelationWidget::tqinvalidateActions() { setAvailable("edit_delete", m_relationView->selectedConnection() || m_relationView->focusedTableView()); } -void KexiRelationWidget::executePopup( QPoint pos ) +void KexiRelationWidget::executePopup( TQPoint pos ) { - if (pos==QPoint(-1,-1)) { + if (pos==TQPoint(-1,-1)) { pos = mapToGlobal( m_relationView->focusedTableView() ? m_relationView->focusedTableView()->pos() + m_relationView->focusedTableView()->rect().center() : rect().center() ); } @@ -302,14 +302,14 @@ void KexiRelationWidget::designSelectedTable() Kexi::DesignViewMode, openingCancelled); } -QSize KexiRelationWidget::sizeHint() const +TQSize KexiRelationWidget::tqsizeHint() const { - return m_relationView->sizeHint(); + return m_relationView->tqsizeHint(); } void KexiRelationWidget::slotTableHidden(KexiDB::TableSchema &table) { - const QString &t = table.name().lower(); + const TQString &t = table.name().lower(); int i; for (i=0; i<m_tableCombo->count() && t > m_tableCombo->text(i).lower(); i++) ; @@ -328,7 +328,7 @@ void KexiRelationWidget::aboutToShowPopupMenu() /*! @todo what about query? */ if (m_relationView->focusedTableView() && m_relationView->focusedTableView()->schema()->table()) { m_tableQueryPopup->changeTitle(m_tableQueryPopupTitleID, SmallIcon("table"), - QString(m_relationView->focusedTableView()->schema()->name()) + " : " + i18n("Table")); + TQString(m_relationView->focusedTableView()->schema()->name()) + " : " + i18n("Table")); } else if (m_relationView->selectedConnection()) { m_connectionPopup->changeTitle( m_connectionPopupTitleID, @@ -337,12 +337,12 @@ void KexiRelationWidget::aboutToShowPopupMenu() } void -KexiRelationWidget::slotTableFieldDoubleClicked(QListViewItem *i,const QPoint&,int) +KexiRelationWidget::slotTableFieldDoubleClicked(TQListViewItem *i,const TQPoint&,int) { - if (!sender()->isA("KexiRelationViewTable")) + if (!TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->isA("KexiRelationViewTable")) return; - const KexiRelationViewTable* t = static_cast<const KexiRelationViewTable*>(sender()); - const QStringList selectedFieldNames( t->selectedFieldNames() ); + const KexiRelationViewTable* t = static_cast<const KexiRelationViewTable*>(TQT_TQWIDGET(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))); + const TQStringList selectedFieldNames( t->selectedFieldNames() ); if (selectedFieldNames.count()==1) emit tableFieldDoubleClicked( t->schema()->table(), selectedFieldNames.first() ); } @@ -364,26 +364,26 @@ void KexiRelationWidget::fillTablesCombo() { m_tableCombo->clear(); - QStringList tmp = m_conn->tableNames(); + TQStringList tmp = m_conn->tableNames(); tmp.sort(); m_tableCombo->insertStringList(tmp); } void -KexiRelationWidget::objectCreated(const QCString &mime, const QCString& name) +KexiRelationWidget::objectCreated(const TQCString &mime, const TQCString& name) { if (mime=="kexi/table" || mime=="kexi/query") { //! @todo query? - m_tableCombo->insertItem(QString(name)); + m_tableCombo->insertItem(TQString(name)); m_tableCombo->listBox()->sort(); } } void -KexiRelationWidget::objectDeleted(const QCString &mime, const QCString& name) +KexiRelationWidget::objectDeleted(const TQCString &mime, const TQCString& name) { if (mime=="kexi/table" || mime=="kexi/query") { - QString strName(name); + TQString strName(name); for (int i=0; i<m_tableCombo->count(); i++) { //! @todo query? if (m_tableCombo->text(i)==strName) { @@ -401,14 +401,14 @@ KexiRelationWidget::objectDeleted(const QCString &mime, const QCString& name) } void -KexiRelationWidget::objectRenamed(const QCString &mime, const QCString& name, const QCString& newName) +KexiRelationWidget::objectRenamed(const TQCString &mime, const TQCString& name, const TQCString& newName) { if (mime=="kexi/table" || mime=="kexi/query") { - QString strName(name); + TQString strName(name); for (int i=0; i<m_tableCombo->count(); i++) { //! @todo query? if (m_tableCombo->text(i)==strName) { - m_tableCombo->changeItem(QString(newName), i); + m_tableCombo->changeItem(TQString(newName), i); m_tableCombo->listBox()->sort(); break; } |