File suse_default_move.diff of Package KDE

diff -urN kde3-kdebase-master.orig/CMakeLists.txt kde3-kdebase-master/CMakeLists.txt
--- kde3-kdebase-master.orig/CMakeLists.txt	2014-03-02 17:52:59.079791197 +0200
+++ kde3-kdebase-master/CMakeLists.txt	2014-03-02 18:01:24.225085022 +0200
@@ -173,3 +173,20 @@
 ##### write configure files #####################
 
 configure_file( config.h.cmake config.h @ONLY )
+
+
+##### default_desktop_aligning ##################
+
+include_directories(
+  ${CMAKE_CURRENT_BINARY_DIR}
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${KDE_INCLUDE_DIR}
+  ${QT_INCLUDE_DIR}
+)
+
+
+kde_add_executable( default_desktop_aligning AUTOMOC
+  SOURCES moving.cpp kdesktop/KDesktopIface.stub
+  LINK kdeui-shared
+  DESTINATION ${BIN_INSTALL_DIR}
+)
diff -urN kde3-kdebase-master.orig/moving.cpp kde3-kdebase-master/moving.cpp
--- kde3-kdebase-master.orig/moving.cpp	1970-01-01 02:00:00.000000000 +0200
+++ kde3-kdebase-master/moving.cpp	2014-03-02 17:53:57.000000000 +0200
@@ -0,0 +1,56 @@
+#include <kstandarddirs.h>
+#include <kglobalsettings.h>
+#include <kapplication.h>
+#include "KDesktopIface_stub.h"
+#include <kdebugclasses.h>
+#include <kcmdlineargs.h>
+#include <kconfig.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <qfileinfo.h>
+
+int main(int argc, char **argv)
+{
+    KCmdLineArgs::init(argc, argv, "default_desktop_moving",
+                          "move the icons on the correct place on initial boot",
+                          "0.1");
+    KApplication app;
+    QStringList icons = KGlobal::dirs()->findAllResources("data", "default_desktop/*.desktop");
+    char buffer[PATH_MAX];
+    strcpy(buffer, "/tmp/suse_desktop_XXXXXX");
+    mkdtemp(buffer);
+    QString tname = QString::fromLatin1(buffer);
+
+    icons.sort();
+
+    KDesktopIface_stub stub("kdesktop", "KDesktopIface");
+    KConfig c( "kdesktoprc" );
+    c.setGroup( "General" );
+
+    if ( c.readBoolEntry( "CopyDesktopLinks", true ) )
+    for (QStringList::ConstIterator it = icons.begin(); it != icons.end(); ++it)
+    {
+        QString name = *it;
+        QPoint t;
+        bool col = (name.mid(name.findRev('/') + 1, 4) == "COL_");
+        name = name.mid(name.findRev('/') + 5, name.length());
+        int index = name.find('_');
+        int num = name.left(index).toInt();
+
+        if (col)
+            t = stub.findPlaceForIcon(num, -1);
+        else
+            t = stub.findPlaceForIcon(-1, num);
+        QFileInfo f(*it);
+
+        name = name.mid(name.find('_', index + 1) + 1, name.length());
+
+	 if ( 0 == system(QString("mv '%1' '%1'").arg(*it).arg(tname + "/" + name).local8Bit()) )
+        	stub.addIcon( tname + "/" + name, t.x(), t.y());
+	
+        sleep(2); // only need to make sure kdesktop goes back in event loop
+    }
+    stub.lineupIcons();
+    system(QString("rm -f %1/moving_desktop.desktop").arg(KGlobalSettings::autostartPath()).latin1());
+    system(QString("rm -rf '%1'").arg(tname).local8Bit());
+}
openSUSE Build Service is sponsored by