From c663b6440964f6ac48027143ac9e63298991f9d0 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:33:34 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1157639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdesktop/desktop.cc | 186 ++++++++++++++++++++++++++-------------------------- 1 file changed, 93 insertions(+), 93 deletions(-) (limited to 'kdesktop/desktop.cc') diff --git a/kdesktop/desktop.cc b/kdesktop/desktop.cc index 18cb69fb4..54513e962 100644 --- a/kdesktop/desktop.cc +++ b/kdesktop/desktop.cc @@ -33,9 +33,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -63,31 +63,31 @@ //#include extern int kdesktop_screen_number; -extern QCString kdesktop_name, kicker_name, kwin_name; +extern TQCString kdesktop_name, kicker_name, kwin_name; -KRootWidget::KRootWidget() : QObject() +KRootWidget::KRootWidget() : TQObject() { kapp->desktop()->installEventFilter(this); kapp->desktop()->setAcceptDrops( true ); } -bool KRootWidget::eventFilter ( QObject *, QEvent * e ) +bool KRootWidget::eventFilter ( TQObject *, TQEvent * e ) { - if (e->type() == QEvent::MouseButtonPress) + if (e->type() == TQEvent::MouseButtonPress) { - QMouseEvent *me = static_cast(e); + TQMouseEvent *me = static_cast(e); KRootWm::self()->mousePressed( me->globalPos(), me->button() ); return true; } - else if (e->type() == QEvent::Wheel) + else if (e->type() == TQEvent::Wheel) { - QWheelEvent *we = static_cast(e); + TQWheelEvent *we = static_cast(e); emit wheelRolled(we->delta()); return true; } - else if ( e->type() == QEvent::DragEnter ) + else if ( e->type() == TQEvent::DragEnter ) { - QDragEnterEvent* de = static_cast( e ); + TQDragEnterEvent* de = static_cast( e ); bool b = !KGlobal::config()->isImmutable() && !KGlobal::dirs()->isRestrictedResource( "wallpaper" ); bool imageURL = false; @@ -102,16 +102,16 @@ bool KRootWidget::eventFilter ( QObject *, QEvent * e ) imageURL = true; } - b = b && ( KColorDrag::canDecode( de ) || QImageDrag::canDecode( de ) || imageURL ); + b = b && ( KColorDrag::canDecode( de ) || TQImageDrag::canDecode( de ) || imageURL ); de->accept( b ); return true; } - else if ( e->type() == QEvent::Drop ) + else if ( e->type() == TQEvent::Drop ) { - QDropEvent* de = static_cast( e ); + TQDropEvent* de = static_cast( e ); if ( KColorDrag::canDecode( de ) ) emit colorDropEvent( de ); - else if ( QImageDrag::canDecode( de ) ) + else if ( TQImageDrag::canDecode( de ) ) emit imageDropEvent( de ); else if ( KURLDrag::canDecode( de ) ) { KURL::List list; @@ -132,7 +132,7 @@ const char* KDesktop::m_wheelDirectionStrings[2] = { "Forward", "Reverse" }; KDesktop::KDesktop( bool x_root_hack, bool wait_for_kded ) : DCOPObject( "KDesktopIface" ), - QWidget( 0L, "desktop", WResizeNoErase | ( x_root_hack ? (WStyle_Customize | WStyle_NoBorder) : 0) ), + TQWidget( 0L, "desktop", WResizeNoErase | ( x_root_hack ? (WStyle_Customize | WStyle_NoBorder) : 0) ), // those two WStyle_ break kdesktop when the root-hack isn't used (no Dnd) startup_id( NULL ), m_waitForKicker(0) { @@ -149,8 +149,8 @@ KDesktop::KDesktop( bool x_root_hack, bool wait_for_kded ) : m_pKwinmodule = new KWinModule( this ); kapp->dcopClient()->setNotifications(true); - kapp->dcopClient()->connectDCOPSignal(kicker_name, kicker_name, "desktopIconsAreaChanged(QRect, int)", - "KDesktopIface", "desktopIconsAreaChanged(QRect, int)", false); + kapp->dcopClient()->connectDCOPSignal(kicker_name, kicker_name, "desktopIconsAreaChanged(TQRect, int)", + "KDesktopIface", "desktopIconsAreaChanged(TQRect, int)", false); // Dont repaint on configuration changes during construction m_bInit = true; @@ -172,31 +172,31 @@ KDesktop::KDesktop( bool x_root_hack, bool wait_for_kded ) : } - setGeometry( QApplication::desktop()->geometry() ); + setGeometry( TQApplication::desktop()->geometry() ); lower(); - connect( kapp, SIGNAL( shutDown() ), - this, SLOT( slotShutdown() ) ); + connect( kapp, TQT_SIGNAL( shutDown() ), + this, TQT_SLOT( slotShutdown() ) ); - connect(kapp, SIGNAL(settingsChanged(int)), - this, SLOT(slotSettingsChanged(int))); + connect(kapp, TQT_SIGNAL(settingsChanged(int)), + this, TQT_SLOT(slotSettingsChanged(int))); kapp->addKipcEventMask(KIPC::SettingsChanged); kapp->addKipcEventMask(KIPC::IconChanged); - connect(kapp, SIGNAL(iconChanged(int)), this, SLOT(slotIconChanged(int))); + connect(kapp, TQT_SIGNAL(iconChanged(int)), this, TQT_SLOT(slotIconChanged(int))); - connect(KSycoca::self(), SIGNAL(databaseChanged()), - this, SLOT(slotDatabaseChanged())); + connect(KSycoca::self(), TQT_SIGNAL(databaseChanged()), + this, TQT_SLOT(slotDatabaseChanged())); m_pIconView = 0; m_pRootWidget = 0; bgMgr = 0; initRoot(); - QTimer::singleShot(0, this, SLOT( slotStart() )); + TQTimer::singleShot(0, this, TQT_SLOT( slotStart() )); #if (QT_VERSION-0 >= 0x030200) // XRANDR support - connect( kapp->desktop(), SIGNAL( resized( int )), SLOT( desktopResized())); + connect( kapp->desktop(), TQT_SIGNAL( resized( int )), TQT_SLOT( desktopResized())); #endif } @@ -219,8 +219,8 @@ KDesktop::initRoot() m_pIconView = 0; { // trigger creation of QToolTipManager, it does XSelectInput() on the root window - QWidget w; - QToolTip::add( &w, "foo" ); + TQWidget w; + TQToolTip::add( &w, "foo" ); } // NOTE: If mouse clicks stop working again, it's most probably something doing XSelectInput() // on the root window after this, and setting it to some fixed value instead of adding its mask. @@ -229,21 +229,21 @@ KDesktop::initRoot() XSelectInput(dpy, root, attrs.your_event_mask | ButtonPressMask); m_pRootWidget = new KRootWidget; - connect(m_pRootWidget, SIGNAL(wheelRolled(int)), this, SLOT(slotSwitchDesktops(int))); - connect(m_pRootWidget, SIGNAL(colorDropEvent(QDropEvent*)), this, SLOT(handleColorDropEvent(QDropEvent*)) ); - connect(m_pRootWidget, SIGNAL(imageDropEvent(QDropEvent*)), this, SLOT(handleImageDropEvent(QDropEvent*)) ); - connect(m_pRootWidget, SIGNAL(newWallpaper(const KURL&)), this, SLOT(slotNewWallpaper(const KURL&)) ); + connect(m_pRootWidget, TQT_SIGNAL(wheelRolled(int)), this, TQT_SLOT(slotSwitchDesktops(int))); + connect(m_pRootWidget, TQT_SIGNAL(colorDropEvent(TQDropEvent*)), this, TQT_SLOT(handleColorDropEvent(TQDropEvent*)) ); + connect(m_pRootWidget, TQT_SIGNAL(imageDropEvent(TQDropEvent*)), this, TQT_SLOT(handleImageDropEvent(TQDropEvent*)) ); + connect(m_pRootWidget, TQT_SIGNAL(newWallpaper(const KURL&)), this, TQT_SLOT(slotNewWallpaper(const KURL&)) ); // Geert Jansen: backgroundmanager belongs here // TODO tell KBackgroundManager if we change widget() bgMgr = new KBackgroundManager( m_pIconView, m_pKwinmodule ); bgMgr->setExport(1); - connect( bgMgr, SIGNAL( initDone()), SLOT( backgroundInitDone())); + connect( bgMgr, TQT_SIGNAL( initDone()), TQT_SLOT( backgroundInitDone())); if (!m_bInit) { delete KRootWm::self(); KRootWm* krootwm = new KRootWm( this ); // handler for root menu (used by kdesktop on RMB click) - keys->setSlot("Lock Session", krootwm, SLOT(slotLock())); + keys->setSlot("Lock Session", krootwm, TQT_SLOT(slotLock())); keys->updateConnections(); } } @@ -254,21 +254,21 @@ KDesktop::initRoot() delete m_pRootWidget; m_pRootWidget = 0; m_pIconView = new KDIconView( this, 0 ); - connect( m_pIconView, SIGNAL( imageDropEvent( QDropEvent * ) ), - this, SLOT( handleImageDropEvent( QDropEvent * ) ) ); - connect( m_pIconView, SIGNAL( colorDropEvent( QDropEvent * ) ), - this, SLOT( handleColorDropEvent( QDropEvent * ) ) ); - connect( m_pIconView, SIGNAL( newWallpaper( const KURL & ) ), - this, SLOT( slotNewWallpaper( const KURL & ) ) ); - connect( m_pIconView, SIGNAL( wheelRolled( int ) ), - this, SLOT( slotSwitchDesktops( int ) ) ); + connect( m_pIconView, TQT_SIGNAL( imageDropEvent( TQDropEvent * ) ), + this, TQT_SLOT( handleImageDropEvent( TQDropEvent * ) ) ); + connect( m_pIconView, TQT_SIGNAL( colorDropEvent( TQDropEvent * ) ), + this, TQT_SLOT( handleColorDropEvent( TQDropEvent * ) ) ); + connect( m_pIconView, TQT_SIGNAL( newWallpaper( const KURL & ) ), + this, TQT_SLOT( slotNewWallpaper( const KURL & ) ) ); + connect( m_pIconView, TQT_SIGNAL( wheelRolled( int ) ), + this, TQT_SLOT( slotSwitchDesktops( int ) ) ); // All the QScrollView/QWidget-specific stuff should go here, so that we can use // another qscrollview/widget instead of the iconview and use the same code - m_pIconView->setVScrollBarMode( QScrollView::AlwaysOff ); - m_pIconView->setHScrollBarMode( QScrollView::AlwaysOff ); + m_pIconView->setVScrollBarMode( TQScrollView::AlwaysOff ); + m_pIconView->setHScrollBarMode( TQScrollView::AlwaysOff ); m_pIconView->setDragAutoScroll( false ); - m_pIconView->setFrameStyle( QFrame::NoFrame ); + m_pIconView->setFrameStyle( TQFrame::NoFrame ); m_pIconView->viewport()->setBackgroundMode( X11ParentRelative ); m_pIconView->setFocusPolicy( StrongFocus ); m_pIconView->viewport()->setFocusPolicy( StrongFocus ); @@ -279,23 +279,23 @@ KDesktop::initRoot() // TODO tell KBackgroundManager if we change widget() bgMgr = new KBackgroundManager( m_pIconView, m_pKwinmodule ); bgMgr->setExport(1); - connect( bgMgr, SIGNAL( initDone()), SLOT( backgroundInitDone())); + connect( bgMgr, TQT_SIGNAL( initDone()), TQT_SLOT( backgroundInitDone())); // make sure it is initialized before we first call updateWorkArea() m_pIconView->initConfig( m_bInit ); // set the size of the area for desktop icons placement { - QByteArray data, result; - QDataStream arg(data, IO_WriteOnly); + TQByteArray data, result; + TQDataStream arg(data, IO_WriteOnly); arg << kdesktop_screen_number; - QCString replyType; - QRect area; + TQCString replyType; + TQRect area; if ( kapp->dcopClient()->call(kicker_name, kicker_name, "desktopIconsArea(int)", data, replyType, result, false, 2000) ) { - QDataStream res(result, IO_ReadOnly); + TQDataStream res(result, IO_ReadOnly); res >> area; m_pIconView->updateWorkArea(area); @@ -305,8 +305,8 @@ KDesktop::initRoot() { // if we failed to get the information from kicker wait a little - probably // this is the KDE startup and kicker is simply not running yet - m_waitForKicker = new QTimer(this); - connect(m_waitForKicker, SIGNAL(timeout()), this, SLOT(slotNoKicker())); + m_waitForKicker = new TQTimer(this); + connect(m_waitForKicker, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotNoKicker())); m_waitForKicker->start(15000, true); } else // we are not called from the ctor, so kicker should already run @@ -321,12 +321,12 @@ KDesktop::initRoot() m_pIconView->start(); delete KRootWm::self(); KRootWm* krootwm = new KRootWm( this ); // handler for root menu (used by kdesktop on RMB click) - keys->setSlot("Lock Session", krootwm, SLOT(slotLock())); + keys->setSlot("Lock Session", krootwm, TQT_SLOT(slotLock())); keys->updateConnections(); } } else { DCOPRef r( "ksmserver", "ksmserver" ); - r.send( "resumeStartup", QCString( "kdesktop" )); + r.send( "resumeStartup", TQCString( "kdesktop" )); } KWin::setType( winId(), NET::Desktop ); @@ -349,7 +349,7 @@ KDesktop::backgroundInitDone() // avoid flicker if (m_bDesktopEnabled) { - const QPixmap *bg = QApplication::desktop()->screen()->backgroundPixmap(); + const TQPixmap *bg = TQApplication::desktop()->screen()->backgroundPixmap(); if ( bg ) m_pIconView->setErasePixmap( *bg ); @@ -358,7 +358,7 @@ KDesktop::backgroundInitDone() } DCOPRef r( "ksmserver", "ksmserver" ); - r.send( "resumeStartup", QCString( "kdesktop" )); + r.send( "resumeStartup", TQCString( "kdesktop" )); } void @@ -394,9 +394,9 @@ KDesktop::slotStart() keys->readSettings(); keys->updateConnections(); - connect(kapp, SIGNAL(appearanceChanged()), SLOT(slotConfigure())); + connect(kapp, TQT_SIGNAL(appearanceChanged()), TQT_SLOT(slotConfigure())); - QTimer::singleShot(300, this, SLOT( slotUpAndRunning() )); + TQTimer::singleShot(300, this, TQT_SLOT( slotUpAndRunning() )); } void @@ -405,10 +405,10 @@ KDesktop::runAutoStart() // now let's execute all the stuff in the autostart folder. // the stuff will actually be really executed when the event loop is // entered, since KRun internally uses a QTimer - QDir dir( KGlobalSettings::autostartPath() ); - QStringList entries = dir.entryList( QDir::Files ); - QStringList::Iterator it = entries.begin(); - QStringList::Iterator end = entries.end(); + TQDir dir( KGlobalSettings::autostartPath() ); + TQStringList entries = dir.entryList( TQDir::Files ); + TQStringList::Iterator it = entries.begin(); + TQStringList::Iterator end = entries.end(); for (; it != end; ++it ) { // Don't execute backup files @@ -489,7 +489,7 @@ void KDesktop::popupExecuteCommand() popupExecuteCommand(""); } -void KDesktop::popupExecuteCommand(const QString& command) +void KDesktop::popupExecuteCommand(const TQString& command) { if (m_bInit) return; @@ -518,7 +518,7 @@ void KDesktop::popupExecuteCommand(const QString& command) } else { NETRootInfo i( qt_xdisplay(), NET::Supported ); if( !i.isSupported( NET::WM2FullPlacement )) { - QRect rect = KGlobalSettings::desktopGeometry(QCursor::pos()); + TQRect rect = KGlobalSettings::desktopGeometry(TQCursor::pos()); m_miniCli->move(rect.x() + (rect.width() - m_miniCli->width())/2, rect.y() + (rect.height() - m_miniCli->height())/2); } @@ -576,11 +576,11 @@ void KDesktop::unselectAll() m_pIconView->selectAll( false ); } -QStringList KDesktop::selectedURLs() +TQStringList KDesktop::selectedURLs() { if (m_pIconView) return m_pIconView->selectedURLs(); - return QStringList(); + return TQStringList(); } void KDesktop::refreshIcons() @@ -689,7 +689,7 @@ void KDesktop::slotSetVRoot() return; if (KWin::windowInfo(winId()).mappingState() == NET::Withdrawn) { - QTimer::singleShot(100, this, SLOT(slotSetVRoot())); + TQTimer::singleShot(100, this, TQT_SLOT(slotSetVRoot())); return; } @@ -728,12 +728,12 @@ void KDesktop::slotShutdown() } // don't hide when someone presses Alt-F4 on us -void KDesktop::closeEvent(QCloseEvent *e) +void KDesktop::closeEvent(TQCloseEvent *e) { e->ignore(); } -void KDesktop::desktopIconsAreaChanged(const QRect &area, int screen) +void KDesktop::desktopIconsAreaChanged(const TQRect &area, int screen) { // hurra! kicker is alive if ( m_waitForKicker ) m_waitForKicker->stop(); @@ -768,14 +768,14 @@ void KDesktop::slotSwitchDesktops(int delta) } } -void KDesktop::handleColorDropEvent(QDropEvent * e) +void KDesktop::handleColorDropEvent(TQDropEvent * e) { KPopupMenu popup; popup.insertItem(SmallIconSet("colors"),i18n("Set as Primary Background Color"), 1); popup.insertItem(SmallIconSet("colors"),i18n("Set as Secondary Background Color"), 2); int result = popup.exec(e->pos()); - QColor c; + TQColor c; KColorDrag::decode(e, c); switch (result) { case 1: bgMgr->setColor(c, true); break; @@ -785,7 +785,7 @@ void KDesktop::handleColorDropEvent(QDropEvent * e) bgMgr->setWallpaper(0,0); } -void KDesktop::handleImageDropEvent(QDropEvent * e) +void KDesktop::handleImageDropEvent(TQDropEvent * e) { KPopupMenu popup; if ( m_pIconView ) @@ -799,7 +799,7 @@ void KDesktop::handleImageDropEvent(QDropEvent * e) if (result == 1) { bool ok = true; - QString filename = KInputDialog::getText(QString::null, i18n("Enter a name for the image below:"), QString::null, &ok, m_pIconView); + TQString filename = KInputDialog::getText(TQString::null, i18n("Enter a name for the image below:"), TQString::null, &ok, m_pIconView); if (!ok) { @@ -815,9 +815,9 @@ void KDesktop::handleImageDropEvent(QDropEvent * e) filename += ".png"; } - QImage i; - QImageDrag::decode(e, i); - KTempFile tmpFile(QString::null, filename); + TQImage i; + TQImageDrag::decode(e, i); + KTempFile tmpFile(TQString::null, filename); i.save(tmpFile.name(), "PNG"); // We pass 0 as parent window because passing the desktop is not a good idea KURL src; @@ -829,8 +829,8 @@ void KDesktop::handleImageDropEvent(QDropEvent * e) } else if (result == 2) { - QImage i; - QImageDrag::decode(e, i); + TQImage i; + TQImageDrag::decode(e, i); KTempFile tmpFile(KGlobal::dirs()->saveLocation("wallpaper"), ".png"); i.save(tmpFile.name(), "PNG"); kdDebug(1204) << "KDesktop::contentsDropEvent " << tmpFile.name() << endl; @@ -847,9 +847,9 @@ void KDesktop::slotNewWallpaper(const KURL &url) else { // Figure out extension - QString fileName = url.fileName(); - QFileInfo fileInfo( fileName ); - QString ext = fileInfo.extension(); + TQString fileName = url.fileName(); + TQFileInfo fileInfo( fileName ); + TQString ext = fileInfo.extension(); // Store tempfile in a place where it will still be available after a reboot KTempFile tmpFile( KGlobal::dirs()->saveLocation("wallpaper"), "." + ext ); KURL localURL; localURL.setPath( tmpFile.name() ); @@ -948,16 +948,16 @@ void KDesktop::desktopResized() m_pIconView->resize(kapp->desktop()->size()); // get new desktopIconsArea from kicker - QByteArray data, result; - QDataStream arg(data, IO_WriteOnly); + TQByteArray data, result; + TQDataStream arg(data, IO_WriteOnly); arg << kdesktop_screen_number; - QCString replyType; - QRect area; + TQCString replyType; + TQRect area; if ( kapp->dcopClient()->call(kicker_name, kicker_name, "desktopIconsArea(int)", data, replyType, result, false, 2000) ) { - QDataStream res(result, IO_ReadOnly); + TQDataStream res(result, IO_ReadOnly); res >> area; } else @@ -976,14 +976,14 @@ void KDesktop::switchDesktops( int delta ) m_bWheelSwitchesWorkspace = old; } -bool KDesktop::event(QEvent * e) +bool KDesktop::event(TQEvent * e) { - if ( e->type() == QEvent::WindowDeactivate) + if ( e->type() == TQEvent::WindowDeactivate) { if (m_pIconView) m_pIconView->clearSelection(); } - return QWidget::event(e); + return TQWidget::event(e); } #include "desktop.moc" -- cgit v1.2.1