Sophie

Sophie

distrib > Mandriva > 2006.0 > i586 > by-pkgid > ee5019e51831f214d532979b59ea2d61 > files > 24

kdelibs-3.4.2-31.4.20060mdk.src.rpm

--- kdelibs-3.3.2/kio/kfile/kopenwith.cpp--	2005-03-15 10:12:24.261488325 +0100
+++ kdelibs-3.3.2/kio/kfile/kopenwith.cpp	2005-03-15 10:14:52.161938864 +0100
@@ -750,11 +750,17 @@ void KOpenWithDlg::slotOK()
   if (!oldPath.isEmpty() && (oldPath != newPath))
   {
      KDesktopFile orig(oldPath, true);
-     desktop = orig.copyTo(newPath);
+     if ( m_pService )
+         desktop = orig.copyTo( pathToCopyEntry(newPath, m_pService->menuId() ) );
+     else
+         desktop = orig.copyTo(newPath);
   }
   else
   {
-     desktop = new KDesktopFile(newPath);
+     if ( m_pService )
+         desktop = new KDesktopFile(pathToCopyEntry(newPath, m_pService->menuId() ) );
+     else
+         desktop = new KDesktopFile(newPath);  
   }
   desktop->writeEntry("Type", QString::fromLatin1("Application"));
   desktop->writeEntry("Name", initialServiceName);
@@ -802,6 +808,20 @@ void KOpenWithDlg::slotOK()
   accept();
 }
 
+QString KOpenWithDlg::pathToCopyEntry( QString path, QString menuId )
+{
+   if( KStandardDirs::menu_type_by_version()=="kde")
+           return path;
+   QString tmpPath = path.remove( menuId );
+    QString element;
+    element = menuId.remove( "Mandrakelinux-" );
+    element=element.replace( QChar( '-' ), "/" );
+    QString newPath = tmpPath+"Mandrakelinux/"+element;
+   KURL url(newPath);
+    KStandardDirs::makeDir( url.directory() );
+   return newPath;
+}
+
 QString KOpenWithDlg::text() const
 {
     if (!m_command.isEmpty())
--- kdelibs-3.3.2/kio/kfile/kopenwith.h--	2005-03-15 10:12:27.451444897 +0100
+++ kdelibs-3.3.2/kio/kfile/kopenwith.h	2005-03-15 10:15:10.148598155 +0100
@@ -157,7 +157,8 @@ protected:
      * @param value  is the initial value of the line
      */
     void init( const QString& text, const QString& value );
-
+	QString pathToCopyEntry( QString path, QString menuId );
+	
     KURLRequester * edit;
     QString m_command;