diff options
Diffstat (limited to 'lib/kopalette/kopalettemanager.cc')
| -rw-r--r-- | lib/kopalette/kopalettemanager.cc | 192 |
1 files changed, 96 insertions, 96 deletions
diff --git a/lib/kopalette/kopalettemanager.cc b/lib/kopalette/kopalettemanager.cc index e028a7aef..839a6187b 100644 --- a/lib/kopalette/kopalettemanager.cc +++ b/lib/kopalette/kopalettemanager.cc @@ -15,13 +15,13 @@ the Free Software Foundation, Inc.,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <qapplication.h> -#include <qdockarea.h> -#include <qdockwindow.h> -#include <qdict.h> -#include <qwidget.h> -#include <qobject.h> -#include <qevent.h> +#include <tqapplication.h> +#include <tqdockarea.h> +#include <tqdockwindow.h> +#include <tqdict.h> +#include <tqwidget.h> +#include <tqobject.h> +#include <tqevent.h> #include <kparts/event.h> #include <kapplication.h> @@ -43,26 +43,26 @@ KoPaletteManager::KoPaletteManager(KoView * view, KActionCollection *ac, const char * name) - : QObject(view, name) + : TQObject(view, name) { m_view = view; m_view->installEventFilter(this); m_actionCollection = ac; - m_actions = new QDict<KToggleAction>(); - m_widgets = new QDict<QWidget>(); - m_palettes = new QDict<KoPalette>(); + m_actions = new TQDict<KToggleAction>(); + m_widgets = new TQDict<TQWidget>(); + m_palettes = new TQDict<KoPalette>(); m_palettes->setAutoDelete(true); - m_defaultMapping = new QMap<QString, QString>(); - m_currentMapping = new QMap<QString, QString>(); + m_defaultMapping = new TQMap<TQString, TQString>(); + m_currentMapping = new TQMap<TQString, TQString>(); m_fixedWidth = 0; m_setFixedWidth = false; - m_widgetNames = new QStringList(); + m_widgetNames = new TQStringList(); - m_mapper = new QSignalMapper(this); - connect(m_mapper, SIGNAL(mapped(int)), this, SLOT(slotTogglePalette(int))); + m_mapper = new TQSignalMapper(this); + connect(m_mapper, TQT_SIGNAL(mapped(int)), this, TQT_SLOT(slotTogglePalette(int))); m_viewActionMenu = new KActionMenu(i18n("Palettes"), m_actionCollection, "view_palette_action_menu"); KConfig * cfg = KGlobal::config(); @@ -74,7 +74,7 @@ KoPaletteManager::KoPaletteManager(KoView * view, KActionCollection *ac, const c if ( palettesShown) { m_toggleShowHidePalettes = new KToggleAction(i18n("Hide All Palette Windows"), "CTRL+SHIFT+H", this, - SLOT(slotToggleAllPalettes()), + TQT_SLOT(slotToggleAllPalettes()), m_actionCollection, "toggleAllPaletteWindows"); m_toggleShowHidePalettes->setCheckedState(i18n("Show Palette Windows Again")); @@ -82,7 +82,7 @@ KoPaletteManager::KoPaletteManager(KoView * view, KActionCollection *ac, const c else { m_toggleShowHidePalettes = new KToggleAction(i18n("Show Palette Windows Again"), "CTRL+SHIFT+H", this, - SLOT(slotToggleAllPalettes()), + TQT_SLOT(slotToggleAllPalettes()), m_actionCollection, "toggleAllPaletteWindows"); m_toggleShowHidePalettes->setCheckedState(i18n("Hide All Palette Windows")); @@ -90,15 +90,15 @@ KoPaletteManager::KoPaletteManager(KoView * view, KActionCollection *ac, const c m_viewActionMenu->insert(m_toggleShowHidePalettes); // Recreate the palettes in the saved order - QStringList paletteList = QStringList::split(",", cfg->readEntry("palettes")); - QStringList::iterator it; + TQStringList paletteList = TQStringList::split(",", cfg->readEntry("palettes")); + TQStringList::iterator it; for (it = paletteList.begin(); it != paletteList.end(); ++it) { if (cfg->hasGroup("palette-" + (*it))) { cfg->setGroup("palette-" + (*it)); enumKoPaletteStyle style = (enumKoPaletteStyle)cfg->readNumEntry("style", 0); - QString caption = cfg->readEntry("caption", ""); + TQString caption = cfg->readEntry("caption", ""); createPalette((*it), caption, style); } @@ -107,7 +107,7 @@ KoPaletteManager::KoPaletteManager(KoView * view, KActionCollection *ac, const c /* KAction * a = new KAction(i18n("Restore Palettes"), 0, this, - SLOT(slotReset()), + TQT_SLOT(slotReset()), this, "restorePalettes"); m_viewActionMenu->insert(a); */ @@ -129,9 +129,9 @@ KoPaletteManager::~KoPaletteManager() delete m_currentMapping; } -void KoPaletteManager::addWidget(QWidget * widget, - const QString & name, - const QString & paletteName, +void KoPaletteManager::addWidget(TQWidget * widget, + const TQString & name, + const TQString & paletteName, int position, enumKoPaletteStyle style, bool shown) @@ -139,9 +139,9 @@ void KoPaletteManager::addWidget(QWidget * widget, if (!widget) return; - QString pname = paletteName; + TQString pname = paletteName; - QWidget * w = m_widgets->find(name); + TQWidget * w = m_widgets->tqfind(name); if (w != 0 ) { removeWidget(name); @@ -157,16 +157,16 @@ void KoPaletteManager::addWidget(QWidget * widget, visible = cfg->readBoolEntry("visible"); } - KoPalette * palette = m_palettes->find(pname); + KoPalette * palette = m_palettes->tqfind(pname); if (palette == 0) { palette = createPalette(pname, widget->caption(), style); - m_defaultPaletteOrder.append(pname+ "," + QString::number(style)); + m_defaultPaletteOrder.append(pname+ "," + TQString::number(style)); } KToggleAction * a; - a = new KToggleAction(i18n("Show %1").arg(widget->caption()), 0, m_mapper, SLOT(map()), m_actionCollection); - a->setCheckedState(i18n("Hide %1").arg(widget->caption())); + a = new KToggleAction(i18n("Show %1").tqarg(widget->caption()), 0, m_mapper, TQT_SLOT(map()), m_actionCollection); + a->setCheckedState(i18n("Hide %1").tqarg(widget->caption())); m_mapper->setMapping(a, m_widgetNames->count()); // This is the position at which we'll insert the action m_actions->insert( name, a ); @@ -181,11 +181,11 @@ void KoPaletteManager::addWidget(QWidget * widget, m_defaultWidgetOrder.append(name); // Find out the hidden state - if(m_widgetNames->contains(name)) + if(m_widgetNames->tqcontains(name)) { // The widget has already been added (and removed) during this session - if(m_hiddenWidgets.contains(name)) + if(m_hiddenWidgets.tqcontains(name)) palette->hidePage( widget ); else { @@ -229,10 +229,10 @@ void KoPaletteManager::slotReset() m_widgetNames->clear(); // Recreate the palettewindows in the saved order - QStringList::iterator it; + TQStringList::iterator it; for (it = m_defaultPaletteOrder.begin(); it != m_defaultPaletteOrder.end(); ++it) { - QString s = *it; - QString pname = s.section( ",", 0, 0 );; + TQString s = *it; + TQString pname = s.section( ",", 0, 0 );; enumKoPaletteStyle style = (enumKoPaletteStyle)s.section(",", 1,1).toInt(); createPalette(pname, "", style); } @@ -240,14 +240,14 @@ void KoPaletteManager::slotReset() // Place all existing (that we didn't throw away!) tabs in the right palette and in the right order for (it = m_defaultWidgetOrder.begin(); it != m_defaultWidgetOrder.end(); ++it) { - QString widgetName = *it; - QWidget * w = m_widgets->find(widgetName); + TQString widgetName = *it; + TQWidget * w = m_widgets->tqfind(widgetName); if (!w) { continue; } - QString paletteName = *m_defaultMapping->find(widgetName); - KoPalette * p = m_palettes->find(paletteName); + TQString paletteName = *m_defaultMapping->tqfind(widgetName); + KoPalette * p = m_palettes->tqfind(paletteName); if (p == 0) { // Funny -- we should have a consistent set of palettes without holes! @@ -262,57 +262,57 @@ void KoPaletteManager::slotReset() void KoPaletteManager::slotResetFont() { - QDictIterator<KoPalette> it(*m_palettes); + TQDictIterator<KoPalette> it(*m_palettes); for (; it.current(); ++it) { it.current()->resetFont(); } } -QWidget * KoPaletteManager::widget(const QString & name) +TQWidget * KoPaletteManager::widget(const TQString & name) { - return m_widgets->find(name); + return m_widgets->tqfind(name); } -void KoPaletteManager::showWidget(const QString & name) +void KoPaletteManager::showWidget(const TQString & name) { - QWidget * w = m_widgets->find(name); + TQWidget * w = m_widgets->tqfind(name); if (!w) return; - QString pname = *m_currentMapping->find(name); + TQString pname = *m_currentMapping->tqfind(name); if (pname.isNull()) return; - KoPalette * p = m_palettes->find(pname); + KoPalette * p = m_palettes->tqfind(pname); p->showPage(w); - KToggleAction * a = m_actions->find(name); + KToggleAction * a = m_actions->tqfind(name); a->setChecked(true); } -void KoPaletteManager::hideWidget(const QString & name) +void KoPaletteManager::hideWidget(const TQString & name) { - QWidget * w = m_widgets->find(name); + TQWidget * w = m_widgets->tqfind(name); if (!w) return; - QString pname = *m_currentMapping->find(name); + TQString pname = *m_currentMapping->tqfind(name); if (pname.isNull()) return; - KoPalette * p = m_palettes->find(pname); + KoPalette * p = m_palettes->tqfind(pname); p->hidePage(w); - KToggleAction * a = m_actions->find(name); + KToggleAction * a = m_actions->tqfind(name); a->setChecked(false); } -void KoPaletteManager::removeWidget(const QString & name) +void KoPaletteManager::removeWidget(const TQString & name) { - QString palette = *(m_currentMapping->find(name)); + TQString palette = *(m_currentMapping->tqfind(name)); if (palette.isNull()) return; - QWidget * w = m_widgets->find(name); + TQWidget * w = m_widgets->tqfind(name); if (!w) return; - KoPalette * p = m_palettes->find(palette); + KoPalette * p = m_palettes->tqfind(palette); if (!p) return; p->showPage(w); @@ -325,13 +325,13 @@ void KoPaletteManager::removeWidget(const QString & name) m_actionCollection->remove(a); } -KoPalette * KoPaletteManager::createPalette(const QString & name, const QString & caption, enumKoPaletteStyle style) +KoPalette * KoPaletteManager::createPalette(const TQString & name, const TQString & caption, enumKoPaletteStyle style) { Q_ASSERT(m_view); KoPalette * palette = 0; - palette = m_palettes->find(name); + palette = m_palettes->tqfind(name); if (palette) return palette; @@ -359,10 +359,10 @@ KoPalette * KoPaletteManager::createPalette(const QString & name, const QString return palette; } -void KoPaletteManager::placePalette(const QString & name, Qt::Dock location) +void KoPaletteManager::placePalette(const TQString & name, TQt::Dock location) { Q_ASSERT(!name.isNull()); - KoPalette * palette = m_palettes->find(name); + KoPalette * palette = m_palettes->tqfind(name); if (!palette) return; @@ -371,8 +371,8 @@ void KoPaletteManager::placePalette(const QString & name, Qt::Dock location) if (cfg->hasGroup("palette-" + name)) { cfg->setGroup("palette-" + name); - QString dockarea = cfg->readEntry("dockarea", "right"); - QString caption = cfg->readEntry("caption", ""); + TQString dockarea = cfg->readEntry("dockarea", "right"); + TQString caption = cfg->readEntry("caption", ""); int height = cfg->readNumEntry("height", 120); int place = cfg->readNumEntry("place", 0); int width = cfg->readNumEntry("width", 200); @@ -382,10 +382,10 @@ void KoPaletteManager::placePalette(const QString & name, Qt::Dock location) palette->setGeometry(x, y, width, height); palette->setOffset(offset); if (dockarea == "left" && place == 0) { - location = Qt::DockLeft; + location = TQt::DockLeft; } else if (dockarea == "right" && place == 0) { - location = Qt::DockRight; + location = TQt::DockRight; } else { location = DockTornOff; @@ -400,7 +400,7 @@ void KoPaletteManager::placePalette(const QString & name, Qt::Dock location) m_view->mainWindow()->bottomDock()->setAcceptDockWindow(palette, false); // Left and right may accept docks. The height of the screen is important - int h = qApp->desktop()->height(); + int h = tqApp->desktop()->height(); switch (m_dockability) { case (DOCK_ENABLED): m_view->mainWindow()->leftDock()->setAcceptDockWindow(palette, true); @@ -410,7 +410,7 @@ void KoPaletteManager::placePalette(const QString & name, Qt::Dock location) case (DOCK_DISABLED): m_view->mainWindow()->leftDock()->setAcceptDockWindow(palette, false); m_view->mainWindow()->rightDock()->setAcceptDockWindow(palette, false); - m_view->mainWindow()->addDockWindow(palette, Qt::DockTornOff); + m_view->mainWindow()->addDockWindow(palette, TQt::DockTornOff); break; case (DOCK_SMART): if (h > 768) { @@ -421,14 +421,14 @@ void KoPaletteManager::placePalette(const QString & name, Qt::Dock location) else { m_view->mainWindow()->leftDock()->setAcceptDockWindow(palette, false); m_view->mainWindow()->rightDock()->setAcceptDockWindow(palette, false); - m_view->mainWindow()->addDockWindow(palette, Qt::DockTornOff); + m_view->mainWindow()->addDockWindow(palette, TQt::DockTornOff); } break; }; m_view->mainWindow()->lineUpDockWindows(); } -void KoPaletteManager::addPalette(KoPalette * palette, const QString & name, Qt::Dock location) +void KoPaletteManager::addPalette(KoPalette * palette, const TQString & name, TQt::Dock location) { Q_ASSERT(palette); Q_ASSERT(!name.isNull()); @@ -440,10 +440,10 @@ void KoPaletteManager::addPalette(KoPalette * palette, const QString & name, Qt: void KoPaletteManager::slotTogglePalette(int paletteIndex) { // Toggle the right palette - QString name = *m_widgetNames->at(paletteIndex); - QWidget * w = m_widgets->find(name); - QString pname = *m_currentMapping->find(name); - KoPalette * p = m_palettes->find(pname); + TQString name = *m_widgetNames->at(paletteIndex); + TQWidget * w = m_widgets->tqfind(name); + TQString pname = *m_currentMapping->tqfind(name); + KoPalette * p = m_palettes->tqfind(pname); p->togglePageHidden( w ); m_hiddenWidgets.clear(); @@ -456,13 +456,13 @@ void KoPaletteManager::slotToggleAllPalettes() // Restore previous visibility state while(!m_hiddenWidgets.isEmpty()) { - QString name = m_hiddenWidgets.pop(); - QWidget *w = m_widgets->find(name); - KToggleAction * a = m_actions->find(name); + TQString name = m_hiddenWidgets.pop(); + TQWidget *w = m_widgets->tqfind(name); + KToggleAction * a = m_actions->tqfind(name); a->setChecked(true); - QString pname = *m_currentMapping->find(name); - KoPalette * p = m_palettes->find(pname); + TQString pname = *m_currentMapping->tqfind(name); + KoPalette * p = m_palettes->tqfind(pname); p->showPage(w); } } @@ -470,17 +470,17 @@ void KoPaletteManager::slotToggleAllPalettes() { // Save hidden state and hide all palettes m_hiddenWidgets.clear(); - QDictIterator<QWidget> it(*m_widgets); + TQDictIterator<TQWidget> it(*m_widgets); for (; it.current(); ++it) { - KToggleAction * a = m_actions->find(it.currentKey()); + KToggleAction * a = m_actions->tqfind(it.currentKey()); if(a->isChecked()) { a->setChecked(false); m_hiddenWidgets.push(it.currentKey()); - QString pname = *m_currentMapping->find(it.currentKey()); - KoPalette * p = m_palettes->find(pname); + TQString pname = *m_currentMapping->tqfind(it.currentKey()); + KoPalette * p = m_palettes->tqfind(pname); p->hidePage(it.current()); } } @@ -489,17 +489,17 @@ void KoPaletteManager::slotToggleAllPalettes() void KoPaletteManager::showAllPalettes(bool shown) { - QDictIterator<KoPalette> it(*m_palettes); + TQDictIterator<KoPalette> it(*m_palettes); for (; it.current(); ++it) { it.current()->makeVisible(shown); } } -bool KoPaletteManager::eventFilter( QObject *o, QEvent *e ) +bool KoPaletteManager::eventFilter( TQObject *o, TQEvent *e ) { - if (o != m_view) return false; + if (TQT_BASE_OBJECT(o) != TQT_BASE_OBJECT(m_view)) return false; - if(e && e->type() == (QEvent::User + 42)) { + if(e && e->type() == (TQEvent::User + 42)) { KParts::PartActivateEvent * pae = dynamic_cast<KParts::PartActivateEvent *>(e); if(pae && pae->widget() && pae->widget() == m_view) { if (pae->activated()) { @@ -533,12 +533,12 @@ void KoPaletteManager::save() Q_ASSERT(cfg); cfg->setGroup(""); - QString widgets; + TQString widgets; // Save the list of palettes - QDictIterator<KoPalette> itP(*m_palettes); + TQDictIterator<KoPalette> itP(*m_palettes); - QStringList paletteList; + TQStringList paletteList; for (; itP.current(); ++itP) { @@ -567,10 +567,10 @@ void KoPaletteManager::save() paletteList.append(itP.currentKey()); } else { - QStringList::iterator it; + TQStringList::iterator it; bool inserted = false; for (it = paletteList.begin(); it != paletteList.end(); ++it) { - KoPalette * p2 = m_palettes->find((*it)); + KoPalette * p2 = m_palettes->tqfind((*it)); if (p2->y() > p->y()) { paletteList.insert(it, itP.currentKey()); inserted = true; @@ -589,18 +589,18 @@ void KoPaletteManager::save() bool palettesShown = m_hiddenWidgets.isEmpty(); cfg->writeEntry("palettesshown", palettesShown); - QDictIterator<QWidget> itW(*m_widgets); + TQDictIterator<TQWidget> itW(*m_widgets); for (; itW.current(); ++itW) { cfg->setGroup("palettetab-" + itW.currentKey()); - QString pname = *m_currentMapping->find(itW.currentKey()); - KoPalette * p = m_palettes->find(pname); - QWidget * w = itW.current(); + TQString pname = *m_currentMapping->tqfind(itW.currentKey()); + KoPalette * p = m_palettes->tqfind(pname); + TQWidget * w = itW.current(); cfg->writeEntry("docker", pname); if(palettesShown) cfg->writeEntry("visible", !p->isHidden(w)); else - if(m_hiddenWidgets.contains(itW.currentKey())) + if(m_hiddenWidgets.tqcontains(itW.currentKey())) cfg->writeEntry("visible", true); else cfg->writeEntry("visible", false); |
