diff options
Diffstat (limited to 'quanta/utility/toolbartabwidget.cpp')
-rw-r--r-- | quanta/utility/toolbartabwidget.cpp | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/quanta/utility/toolbartabwidget.cpp b/quanta/utility/toolbartabwidget.cpp index 03c6e86b..29c7cfa9 100644 --- a/quanta/utility/toolbartabwidget.cpp +++ b/quanta/utility/toolbartabwidget.cpp @@ -13,14 +13,14 @@ ***************************************************************************/ //qt includes -#include <qevent.h> -#include <qlayout.h> -#include <qobjectlist.h> -#include <qpoint.h> -#include <qtabbar.h> -#include <qwidgetstack.h> -#include <qtabwidget.h> -#include <qfontmetrics.h> +#include <tqevent.h> +#include <tqlayout.h> +#include <tqobjectlist.h> +#include <tqpoint.h> +#include <tqtabbar.h> +#include <tqwidgetstack.h> +#include <tqtabwidget.h> +#include <tqfontmetrics.h> //kde includes #include <kaction.h> @@ -38,45 +38,45 @@ //app includes #include "toolbartabwidget.h" -ToolbarTabWidget::ToolbarTabWidget(QWidget * parent, const char * name, WFlags f) -:QTabWidget(parent, name, f) +ToolbarTabWidget::ToolbarTabWidget(TQWidget * parent, const char * name, WFlags f) +:TQTabWidget(parent, name, f) { m_popupMenu = new KPopupMenu(this); m_popupMenu->insertTitle(i18n("Toolbar Menu"), 1); - m_popupMenu->insertItem(i18n("New Action..."), parent, SLOT(slotNewAction())); + m_popupMenu->insertItem(i18n("New Action..."), parent, TQT_SLOT(slotNewAction())); m_popupMenu->insertSeparator(); - m_popupMenu->insertItem(i18n("New Toolbar..."), parent, SLOT(slotAddToolbar())); - m_popupMenu->insertItem(i18n("Remove Toolbar"), this, SLOT(slotRemoveToolbar())); - m_popupMenu->insertItem(i18n("Rename Toolbar..."), this, SLOT(slotRenameToolbar())); - m_popupMenu->insertItem(SmallIconSet("configure_toolbars"), i18n("Configure Toolbars..."), this, SLOT(slotEditToolbar())); + m_popupMenu->insertItem(i18n("New Toolbar..."), parent, TQT_SLOT(slotAddToolbar())); + m_popupMenu->insertItem(i18n("Remove Toolbar"), this, TQT_SLOT(slotRemoveToolbar())); + m_popupMenu->insertItem(i18n("Rename Toolbar..."), this, TQT_SLOT(slotRenameToolbar())); + m_popupMenu->insertItem(SmallIconSet("configure_toolbars"), i18n("Configure Toolbars..."), this, TQT_SLOT(slotEditToolbar())); - connect(this, SIGNAL(removeToolbar(const QString&)), - parent, SLOT(slotRemoveToolbar(const QString&))); - connect(this, SIGNAL(renameToolbar(const QString&)), - parent, SLOT(slotRenameToolbar(const QString&))); - connect(this, SIGNAL(editToolbar(const QString&)), - parent, SLOT(slotConfigureToolbars(const QString&))); - connect(this, SIGNAL(newAction()), - parent, SLOT(slotNewAction())); - connect(this, SIGNAL(addToolbar()), - parent, SLOT(slotAddToolbar())); + connect(this, TQT_SIGNAL(removeToolbar(const TQString&)), + parent, TQT_SLOT(slotRemoveToolbar(const TQString&))); + connect(this, TQT_SIGNAL(renameToolbar(const TQString&)), + parent, TQT_SLOT(slotRenameToolbar(const TQString&))); + connect(this, TQT_SIGNAL(editToolbar(const TQString&)), + parent, TQT_SLOT(slotConfigureToolbars(const TQString&))); + connect(this, TQT_SIGNAL(newAction()), + parent, TQT_SLOT(slotNewAction())); + connect(this, TQT_SIGNAL(addToolbar()), + parent, TQT_SLOT(slotAddToolbar())); KAcceleratorManager::setNoAccel(this); } -void ToolbarTabWidget::insertTab(QWidget *child, const QString &label, const QString &id) +void ToolbarTabWidget::insertTab(TQWidget *child, const TQString &label, const TQString &id) { if (child->inherits("KToolBar") && child->parentWidget()) { - QTabWidget::insertTab(child->parentWidget(), label); + TQTabWidget::insertTab(child->parentWidget(), label); toolbarList.insert(id, child); } } -QWidget* ToolbarTabWidget::page(int index) +TQWidget* ToolbarTabWidget::page(int index) { - QWidget *w = QTabWidget::page(index); + TQWidget *w = TQTabWidget::page(index); - for (QMap<QString, QWidget*>::Iterator it = toolbarList.begin(); it != toolbarList.end(); ++it) + for (TQMap<TQString, TQWidget*>::Iterator it = toolbarList.begin(); it != toolbarList.end(); ++it) { if (it.data()->parentWidget() == w) { @@ -87,10 +87,10 @@ QWidget* ToolbarTabWidget::page(int index) return w; } -QString ToolbarTabWidget::id(QWidget *w) const +TQString ToolbarTabWidget::id(TQWidget *w) const { - QString idStr; - for (QMap<QString, QWidget*>::ConstIterator it = toolbarList.constBegin(); it != toolbarList.constEnd(); ++it) + TQString idStr; + for (TQMap<TQString, TQWidget*>::ConstIterator it = toolbarList.constBegin(); it != toolbarList.constEnd(); ++it) { if (it.data()->parentWidget() == w) { @@ -101,11 +101,11 @@ QString ToolbarTabWidget::id(QWidget *w) const return idStr; } -QString ToolbarTabWidget::id(int index) const +TQString ToolbarTabWidget::id(int index) const { - QWidget *w = QTabWidget::page(index); - QString idStr; - for (QMap<QString, QWidget*>::ConstIterator it = toolbarList.constBegin(); it != toolbarList.constEnd(); ++it) + TQWidget *w = TQTabWidget::page(index); + TQString idStr; + for (TQMap<TQString, TQWidget*>::ConstIterator it = toolbarList.constBegin(); it != toolbarList.constEnd(); ++it) { if (it.data()->parentWidget() == w) { @@ -116,19 +116,19 @@ QString ToolbarTabWidget::id(int index) const return idStr; } -QWidget* ToolbarTabWidget::page(const QString& id) +TQWidget* ToolbarTabWidget::page(const TQString& id) { - QWidget *w = toolbarList.find(id).data(); + TQWidget *w = toolbarList.find(id).data(); return w; } -void ToolbarTabWidget::removePage(QWidget * w) +void ToolbarTabWidget::removePage(TQWidget * w) { - QWidget *parent = w->parentWidget(); + TQWidget *parent = w->parentWidget(); if (w->inherits("KToolBar") && parent) { - QTabWidget::removePage(parent); - for (QMap<QString, QWidget*>::ConstIterator it = toolbarList.constBegin(); it != toolbarList.constEnd(); ++it) + TQTabWidget::removePage(parent); + for (TQMap<TQString, TQWidget*>::ConstIterator it = toolbarList.constBegin(); it != toolbarList.constEnd(); ++it) { if (it.data() == w) { @@ -155,21 +155,21 @@ void ToolbarTabWidget::slotEditToolbar() emit editToolbar(tabUnderMouseLabel + " <quanta>"); } -void ToolbarTabWidget::mousePressEvent ( QMouseEvent * e ) +void ToolbarTabWidget::mousePressEvent ( TQMouseEvent * e ) { if (e->button() == Qt::RightButton) { - QPoint p = e->globalPos(); - QTab *tab = 0L; - QWidget *pageW = 0L; + TQPoint p = e->globalPos(); + TQTab *tab = 0L; + TQWidget *pageW = 0L; for (int i =0; i < tabBar()->count(); i++) { tab = tabBar()->tabAt(i); pageW = page(i); - QRect r = tab->rect(); - QPoint p1 = mapToGlobal(r.topLeft()); - QPoint p2 = mapToGlobal(r.bottomRight()); - if (QRect(p1, p2).contains(p)) + TQRect r = tab->rect(); + TQPoint p1 = mapToGlobal(r.topLeft()); + TQPoint p2 = mapToGlobal(r.bottomRight()); + if (TQRect(p1, p2).contains(p)) break; else tab = 0L; @@ -177,7 +177,7 @@ void ToolbarTabWidget::mousePressEvent ( QMouseEvent * e ) tabUnderMouseLabel = tab ? tab->text() : label(currentPageIndex()); if (!pageW) pageW = currentPage(); - for (QMap<QString, QWidget*>::Iterator it = toolbarList.begin(); it != toolbarList.end(); ++it) + for (TQMap<TQString, TQWidget*>::Iterator it = toolbarList.begin(); it != toolbarList.end(); ++it) { if (it.data()->parentWidget() == pageW) { @@ -191,14 +191,14 @@ void ToolbarTabWidget::mousePressEvent ( QMouseEvent * e ) } -void ToolbarTabWidget::resizeEvent(QResizeEvent *e) +void ToolbarTabWidget::resizeEvent(TQResizeEvent *e) { - QWidget::resizeEvent(e); - QWidget *tb; - for (QMap<QString, QWidget*>::Iterator it = toolbarList.begin(); it != toolbarList.end(); ++it) + TQWidget::resizeEvent(e); + TQWidget *tb; + for (TQMap<TQString, TQWidget*>::Iterator it = toolbarList.begin(); it != toolbarList.end(); ++it) { tb = it.data(); - tb->resize(QSize(width(), tb->height())); + tb->resize(TQSize(width(), tb->height())); } int i = currentPageIndex(); if (i > 0) @@ -217,13 +217,13 @@ int ToolbarTabWidget::tabHeight() const int height = tabBar()->height(); if (height < 2) { - height = QFontMetrics(KGlobalSettings::generalFont()).height() + 12; + height = TQFontMetrics(KGlobalSettings::generalFont()).height() + 12; } return height; } -QuantaToolBar::QuantaToolBar(QWidget *parent, const char *name, bool honor_style, bool readConfig) +QuantaToolBar::QuantaToolBar(TQWidget *parent, const char *name, bool honor_style, bool readConfig) :KToolBar (parent, name=0, honor_style, readConfig) { m_popupMenu = new KPopupMenu(this); @@ -235,8 +235,8 @@ QuantaToolBar::QuantaToolBar(QWidget *parent, const char *name, bool honor_style m_iconTextMenu->insertItem(i18n("Text Only"), 1); m_iconTextMenu->insertItem(i18n("Text Alongside Icons"), 2); m_iconTextMenu->insertItem(i18n("Text Under Icons"), 3); - connect(m_iconTextMenu, SIGNAL(activated(int)), SLOT(slotIconTextChanged(int))); - connect(m_iconTextMenu, SIGNAL(aboutToShow()), SLOT(slotIconTextMenuAboutToShow())); + connect(m_iconTextMenu, TQT_SIGNAL(activated(int)), TQT_SLOT(slotIconTextChanged(int))); + connect(m_iconTextMenu, TQT_SIGNAL(aboutToShow()), TQT_SLOT(slotIconTextMenuAboutToShow())); setIconText(ToolbarTabWidget::ref()->iconText(), false); } @@ -263,7 +263,7 @@ void QuantaToolBar::slotIconTextChanged(int id) { ToolbarTabWidget *toolbarTab = ToolbarTabWidget::ref(); int width = toolbarTab->width(); - int bigHeight = iconSize() + QFontMetrics(KGlobalSettings::toolBarFont()).height() + 10; + int bigHeight = iconSize() + TQFontMetrics(KGlobalSettings::toolBarFont()).height() + 10; int normalHeight = iconSize() + 10; for (int i = 0; i < toolbarTab->count(); i++) { @@ -294,41 +294,41 @@ void QuantaToolBar::slotIconTextChanged(int id) } } -void QuantaToolBar::mousePressEvent(QMouseEvent *e) +void QuantaToolBar::mousePressEvent(TQMouseEvent *e) { if (e->button() == Qt::RightButton) { m_popupMenu->clear(); - QPoint p = e->globalPos(); + TQPoint p = e->globalPos(); if (m_toolbarTab) { m_toolbarTab->tabUnderMouse = m_toolbarTab->id(m_toolbarTab->currentPageIndex()); m_toolbarTab->tabUnderMouseLabel = m_toolbarTab->label(m_toolbarTab->currentPageIndex()); m_popupMenu->insertTitle(i18n("Toolbar Menu") + " - " + i18n(m_toolbarTab->tabUnderMouseLabel.utf8())); - m_popupMenu->insertItem(i18n("New Action..."), m_toolbarTab, SIGNAL(newAction())); - QObjectList* childrenList = queryList("KToolBarButton"); + m_popupMenu->insertItem(i18n("New Action..."), m_toolbarTab, TQT_SIGNAL(newAction())); + TQObjectList* childrenList = queryList("KToolBarButton"); for (uint i = 0; i < childrenList->count(); i++) { KToolBarButton *w = static_cast<KToolBarButton*>(childrenList->at(i)); - QPoint p1 = w->parentWidget()->mapToGlobal(w->pos()); - QPoint p2 = QPoint(p1.x() + w->width(), p1.y()+w->height()); - if (QRect(p1, p2).contains(p)) + TQPoint p1 = w->parentWidget()->mapToGlobal(w->pos()); + TQPoint p2 = TQPoint(p1.x() + w->width(), p1.y()+w->height()); + if (TQRect(p1, p2).contains(p)) { currentActionName = w->textLabel(); - QString actionName = currentActionName; - m_popupMenu->insertItem(i18n("Remove Action - %1").arg(actionName.replace('&',"&&")), this, SLOT(slotRemoveAction())); - m_popupMenu->insertItem(i18n("Edit Action - %1").arg(actionName), this, SLOT(slotEditAction())); + TQString actionName = currentActionName; + m_popupMenu->insertItem(i18n("Remove Action - %1").arg(actionName.replace('&',"&&")), this, TQT_SLOT(slotRemoveAction())); + m_popupMenu->insertItem(i18n("Edit Action - %1").arg(actionName), this, TQT_SLOT(slotEditAction())); break; } } m_popupMenu->insertSeparator(); - m_popupMenu->insertItem(i18n("New Toolbar..."), m_toolbarTab, SIGNAL(addToolbar())); - m_popupMenu->insertItem(i18n("Remove Toolbar"), m_toolbarTab, SLOT(slotRemoveToolbar())); - m_popupMenu->insertItem(i18n("Rename Toolbar..."), m_toolbarTab, SLOT(slotRenameToolbar())); + m_popupMenu->insertItem(i18n("New Toolbar..."), m_toolbarTab, TQT_SIGNAL(addToolbar())); + m_popupMenu->insertItem(i18n("Remove Toolbar"), m_toolbarTab, TQT_SLOT(slotRemoveToolbar())); + m_popupMenu->insertItem(i18n("Rename Toolbar..."), m_toolbarTab, TQT_SLOT(slotRenameToolbar())); m_popupMenu->insertSeparator(); m_popupMenu->insertItem( i18n("Text Position"), m_iconTextMenu); - m_popupMenu->insertItem(SmallIconSet("configure_toolbars"), i18n("Configure Toolbars..."), m_toolbarTab, SLOT(slotEditToolbar())); + m_popupMenu->insertItem(SmallIconSet("configure_toolbars"), i18n("Configure Toolbars..."), m_toolbarTab, TQT_SLOT(slotEditToolbar())); } m_popupMenu->popup(p); } @@ -341,7 +341,7 @@ void QuantaToolBar::slotEditAction() void QuantaToolBar::slotRemoveAction() { - if ( KMessageBox::warningContinueCancel(this, i18n("<qt>Are you sure you want to remove the <b>%1</b> action?</qt>").arg(currentActionName),QString::null,KStdGuiItem::del()) == KMessageBox::Continue ) + if ( KMessageBox::warningContinueCancel(this, i18n("<qt>Are you sure you want to remove the <b>%1</b> action?</qt>").arg(currentActionName),TQString::null,KStdGuiItem::del()) == KMessageBox::Continue ) { emit removeAction(m_toolbarTab->tabUnderMouse, currentActionName); } |