diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-03 09:14:57 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-03 09:14:57 +0000 |
commit | 27856879bf962f178d88e79144e37a47e731b122 (patch) | |
tree | a3bd3f489b755cd2941e7c53b90d12d6bfd4fbe3 /kdesktop/desktop.cc | |
parent | c5228d52f504d6d2c0fefdd625ec08ebb8e91f85 (diff) | |
download | tdebase-27856879bf962f178d88e79144e37a47e731b122.tar.gz tdebase-27856879bf962f178d88e79144e37a47e731b122.zip |
* 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
Diffstat (limited to 'kdesktop/desktop.cc')
-rw-r--r-- | kdesktop/desktop.cc | 47 |
1 files changed, 47 insertions, 0 deletions
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 <unistd.h> #include <kcolordrag.h> #include <kurldrag.h> +#include <stdlib.h> +#include <kio/job.h> +#include <tqfile.h> #include <tqdir.h> #include <tqevent.h> @@ -58,6 +61,7 @@ #include <kglobalsettings.h> #include <kpopupmenu.h> #include <kapplication.h> +#include <kdirlister.h> // Create the equivalent of KAccelBase::connectItem // and then remove this include and fix reconnects in initRoot() -- ellis //#include <kaccelbase.h> @@ -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<KIO::CopyInfo> 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" |