diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2016-03-25 20:03:28 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2016-03-25 20:03:28 +0100 |
commit | 2ee99ab520931c5efe91123c85ba10064a45e95d (patch) | |
tree | a367666e410de28d0f258aed77b11e17cafb28e4 /sidebar/linkview.cpp | |
parent | cfa36e1a95e82492c17225ff376911abb3688f62 (diff) | |
download | tde-style-baghira-2ee99ab520931c5efe91123c85ba10064a45e95d.tar.gz tde-style-baghira-2ee99ab520931c5efe91123c85ba10064a45e95d.zip |
Initial TQt conversion
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'sidebar/linkview.cpp')
-rw-r--r-- | sidebar/linkview.cpp | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/sidebar/linkview.cpp b/sidebar/linkview.cpp index 8becf29..fa9223b 100644 --- a/sidebar/linkview.cpp +++ b/sidebar/linkview.cpp @@ -1,54 +1,54 @@ #include <stdlib.h> -#include <qcursor.h> -#include <qsplitter.h> +#include <tqcursor.h> +#include <tqsplitter.h> #include <klocale.h> -#include <qdir.h> +#include <tqdir.h> #include <kconfig.h> -#include <qtimer.h> +#include <tqtimer.h> #include "dndlistbox.h" #include "listboxlink.h" #include "linkview.h" #include "linkview.moc" // internal class to eat invalid leave envents (i.e. leave that does not leave the rect but just enters the splitter, as styles (like baghira ;) may post install eventfilters that'd cause useless repaints and therefore flicker if the scroller appereance changes ;) -class EventKiller : public QObject +class EventKiller : public TQObject { protected: - virtual bool eventFilter( QObject *o, QEvent *e) + virtual bool eventFilter( TQObject *o, TQEvent *e) { - if (e->type() == QEvent::Leave) - return ((QScrollView*)o)->rect().contains(((QScrollView*)o)->mapFromGlobal (QCursor::pos())); + if (e->type() == TQEvent::Leave) + return ((TQScrollView*)o)->rect().contains(((TQScrollView*)o)->mapFromGlobal (TQCursor::pos())); return false; } }; -LinkView::LinkView(QWidget * parent, const char * name, WFlags f): - QScrollView(parent, name, f) +LinkView::LinkView(TQWidget * parent, const char * name, WFlags f): + TQScrollView(parent, name, f) { - setFrameShape( QFrame::StyledPanel ); - setFrameShadow( QFrame::Sunken ); - setBackgroundMode(Qt::PaletteBase); + setFrameShape( TQFrame::StyledPanel ); + setFrameShadow( TQFrame::Sunken ); + setBackgroundMode(TQt::PaletteBase); _blocked = FALSE; - splitter = new QSplitter( Qt::Vertical, viewport() ); + splitter = new TQSplitter( TQt::Vertical, viewport() ); addChild(splitter); splitter->setMargin(5); - splitter->setBackgroundMode(Qt::PaletteBase); - splitter->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum); - splitter->setFrameShape( QFrame::NoFrame ); + splitter->setBackgroundMode(TQt::PaletteBase); + splitter->setSizePolicy(TQSizePolicy::Expanding,TQSizePolicy::Minimum); + splitter->setFrameShape( TQFrame::NoFrame ); splitter->setChildrenCollapsible(TRUE); splitter->setHandleWidth( 3 ); splitter->setOpaqueResize(); hardware = new MediaListBox(splitter, "hardware"); - splitter->setResizeMode( hardware, QSplitter::KeepSize ); - hardware->setFrameShape( QFrame::NoFrame ); - hardware->setHScrollBarMode(QScrollView::AlwaysOff); - hardware->setVScrollBarMode(QScrollView::AlwaysOff); + splitter->setResizeMode( hardware, TQSplitter::KeepSize ); + hardware->setFrameShape( TQFrame::NoFrame ); + hardware->setHScrollBarMode(TQScrollView::AlwaysOff); + hardware->setVScrollBarMode(TQScrollView::AlwaysOff); locations = new DnDListBox(splitter, "locations"); -// splitter->setResizeMode( locations, QSplitter::KeepSize ); - locations->setFrameShape( QFrame::NoFrame ); - locations->setHScrollBarMode(QScrollView::AlwaysOff); - locations->setVScrollBarMode(QScrollView::AlwaysOff); +// splitter->setResizeMode( locations, TQSplitter::KeepSize ); + locations->setFrameShape( TQFrame::NoFrame ); + locations->setHScrollBarMode(TQScrollView::AlwaysOff); + locations->setVScrollBarMode(TQScrollView::AlwaysOff); // custom area, locations loadLinks(); locations->setCurrentItem(0); @@ -60,8 +60,8 @@ LinkView::LinkView(QWidget * parent, const char * name, WFlags f): connect (locations, SIGNAL(scrolled(int,int)), this, SLOT(scrollBy(int,int))); connect (hardware, SIGNAL(itemNumberChanged(bool)), this, SLOT(adjustSplitter2Hardware(bool))); connect (locations, SIGNAL(itemNumberChanged(bool)), this, SLOT(adjustSplitter2Locations())); - QTimer::singleShot(50, this, SLOT(adjustSplitter2Locations())); - QTimer::singleShot(60, this, SLOT(postInstallEventFilter())); + TQTimer::singleShot(50, this, SLOT(adjustSplitter2Locations())); + TQTimer::singleShot(60, this, SLOT(postInstallEventFilter())); } static EventKiller *eventKiller = 0L; @@ -79,13 +79,13 @@ void LinkView::postInstallEventFilter() installEventFilter(eventKiller); } -bool LinkView::eventFilter(QObject *o, QEvent *e) +bool LinkView::eventFilter(TQObject *o, TQEvent *e) { if (o != hardware) - return QScrollView::eventFilter(o, e); - if (_blocked || e->type() != QEvent::Resize) + return TQScrollView::eventFilter(o, e); + if (_blocked || e->type() != TQEvent::Resize) return FALSE; // not a resize - non of our business - QResizeEvent *rev = (QResizeEvent*)e; + TQResizeEvent *rev = (TQResizeEvent*)e; if (rev->size().height() == rev->oldSize().height()) return FALSE; // height didn't change int tmpH = rev->size().height() + locations->numRows()*locations->itemHeight()+20; @@ -122,7 +122,7 @@ void LinkView::adjustSplitter2Hardware(bool added) hardware->resize ( hardware->width(), hardware->numRows()*hardware->itemHeight() ); } -void LinkView::viewportResizeEvent( QResizeEvent *rev ) +void LinkView::viewportResizeEvent( TQResizeEvent *rev ) { int tmpH = hardware->height() + locations->numRows()*locations->itemHeight()+20; if (tmpH < rev->size().height()) @@ -144,27 +144,27 @@ void LinkView::loadLinks() { if (!locations) return; - KConfig config(QDir::homeDirPath() + "/.qt/baghirarc"); + KConfig config(TQDir::homeDirPath() + "/.qt/baghirarc"); config.setGroup("Sidebar"); splitter->setSizes(config.readIntListEntry ("Sizes")); loadedLinks = (uint)config.readNumEntry("NumLinks", 0); locations->blockSignals ( true ); if (loadedLinks == 0) // no settings stored - load defaults { - locations->insertItem("desktop", i18n("Desktop"), QDir::homeDirPath()+"/Desktop"); - locations->insertItem("folder_home", getenv("USER"), QDir::homeDirPath()); + locations->insertItem("desktop", i18n("Desktop"), TQDir::homeDirPath()+"/Desktop"); + locations->insertItem("folder_home", getenv("USER"), TQDir::homeDirPath()); locations->insertItem("kmenu", i18n("Programs"), "programs:/"); } - QString num; + TQString num; for (uint i = 0; i < loadedLinks; i++) { - QString title; - QString icon; - QString url; + TQString title; + TQString icon; + TQString url; num.setNum(i); title = config.readEntry("Link_"+num+"_Title", "???"); icon = config.readEntry("Link_"+num+"_Icon", "empty"); - url = config.readEntry("Link_"+num+"_URL", QDir::homeDirPath()); + url = config.readEntry("Link_"+num+"_URL", TQDir::homeDirPath()); locations->insertItem(icon, title, url); } locations->blockSignals ( false ); @@ -174,11 +174,11 @@ void LinkView::saveLinks() { if (!locations) return; - KConfig *config = new KConfig(QDir::homeDirPath() + "/.qt/baghirarc"); + KConfig *config = new KConfig(TQDir::homeDirPath() + "/.qt/baghirarc"); config->setGroup("Sidebar"); config->writeEntry("Sizes", splitter->sizes()); config->writeEntry("NumLinks", (int)locations->count()); - QString num; + TQString num; for (uint i = 0; i < locations->count(); i++) { num.setNum(i); |