From 27856879bf962f178d88e79144e37a47e731b122 Mon Sep 17 00:00:00 2001 From: tpearson Date: Fri, 3 Sep 2010 09:14:57 +0000 Subject: * Massive import of OpenSUSE patches, primarily for bugfixes * Added some infrastructure created by OpenSUSE to allow for future addition of the Kickoff menu as an option * Minor Slackware compilation fixes git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1171255 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdesktop/desktop.cc | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'kdesktop/desktop.cc') diff --git a/kdesktop/desktop.cc b/kdesktop/desktop.cc index 54513e962..a05dfcb99 100644 --- a/kdesktop/desktop.cc +++ b/kdesktop/desktop.cc @@ -32,6 +32,9 @@ #include #include #include +#include +#include +#include #include #include @@ -58,6 +61,7 @@ #include #include #include +#include // Create the equivalent of KAccelBase::connectItem // and then remove this include and fix reconnects in initRoot() -- ellis //#include @@ -986,4 +990,47 @@ bool KDesktop::event(TQEvent * e) return TQWidget::event(e); } +TQPoint KDesktop::findPlaceForIcon( int column, int row ) +{ + if (m_pIconView) + return m_pIconView->findPlaceForIcon(column, row); + else + return TQPoint(-1, -1); +} + +void KDesktop::addIcon(const TQString & _url, int x, int y) +{ + addIcon( _url, KGlobalSettings::desktopPath(), x, y ); +} + +void KDesktop::addIcon(const TQString & _url, const TQString & _dest, int x, int y) +{ + TQString filename = _url.mid(_url.findRev('/') + 1); + + TQValueList files; + KIO::CopyInfo i; + i.uSource = KURL::fromPathOrURL( _url ); + i.uDest = KURL::fromPathOrURL( _dest ); + i.uDest.addPath( filename ); + files.append(i); + if (!TQFile::exists(i.uDest.prettyURL().replace("file://",TQString::null))) { m_pIconView->slotAboutToCreate( TQPoint( x, y ), files ); + KIO::copy( i.uSource, i.uDest, false ); } + +// m_pIconView->addFuturePosition(filename, x, y); + // qDebug("addIcon %s %s %d %d", _url.latin1(), _dest.latin1(), x, y); +// system(TQString("cp \"%1\" \"%2/%3\"").arg(KURL(_url).path()).arg(KURL(_dest).path()).arg(filename).latin1()); +// m_pIconView->update( _dest ); +} + +void KDesktop::removeIcon(const TQString &_url) +{ + if (_url.at(0) != '/') { + qDebug("removeIcon with relative path not supported for now"); + return; + } + unlink(KURL(_url).path().latin1()); + TQString dest = _url.left(_url.findRev('/') + 1); + m_pIconView->update( dest ); +} + #include "desktop.moc" -- cgit v1.2.1