Sophie

Sophie

distrib > Mandriva > 2006.0 > i586 > media > main-src > by-pkgid > a6bc312ce50b5c8d0c51736e58ac32bc > files > 306

kdebase-3.4.2-55mdk.src.rpm

--- kdebase-3.3.2/kioslave/devices/kdedmodule/mountwatcher.cpp--	2005-03-22 15:08:08.570224179 +0100
+++ kdebase-3.3.2/kioslave/devices/kdedmodule/mountwatcher.cpp	2005-03-22 15:08:58.213317561 +0100
@@ -47,6 +47,8 @@ MountWatcherModule::MountWatcherModule(c
     : KDEDModule(obj),mDiskList(this),mtabsize(0)
 {
 	firstTime=true;
+        QString fileMerge = KStandardDirs::mandrake_merge_directory();
+	KDirWatch::self()->addDir(fileMerge);
 
 #ifdef MTAB
 	KDirWatch::self()->addFile(MTAB);
@@ -130,6 +132,11 @@ QStringList MountWatcherModule::basicSys
 	return completeList;
 }
 
+QStringList MountWatcherModule::basicNetworkList()
+{
+    return networkList;
+}
+
 QString  MountWatcherModule::mountpoint(int id)
 {
 	return mDiskList.at(id)->mountPoint();
@@ -208,7 +215,7 @@ void MountWatcherModule::dirty(const QSt
 #ifdef FSTAB
 	if (str==FSTAB)
 	{
-		mDiskList.setAllOld(); 
+		mDiskList.setAllOld();
 		mDiskList.readFSTAB();
 		mDiskList.readMNTTAB();
 		mDiskList.removeOldDisks();
@@ -247,7 +254,7 @@ QStringList MountWatcherModule::basicDev
 {
 	QStringList tmp;
 	for (QStringList::Iterator it=mountList.begin();it!=mountList.end();)
-	{	
+	{
 		QString name=(*it);++it;
 		QString description=(*it); ++it;
 		QString device=(*it); ++it;
@@ -304,6 +311,7 @@ void MountWatcherModule::readDFDone()
   mDiskList.cleanDisk();
 	QStringList oldmountList(mountList);
 	QStringList oldcompleteList(completeList);
+	QStringList oldnetworkList(networkList);
 	mountList.clear();
 	KURL::List fileList;
 	QMap <QString,QString> descriptionToDeviceMap;
@@ -401,7 +409,7 @@ void MountWatcherModule::readDFDone()
                if (descriptionToMountMap[ent->niceDescription()] != ent->mountPoint())
                  name = i18n("%1 [%2]").arg(name).arg(ent->mountPoint());
              }
-			
+
 			mountList<<name;
 			mountList<<ent->deviceName();
 			mountList<<"file:/"+(ent->mountPoint().startsWith("/")?ent->mountPoint().right(ent->mountPoint().length()-1):ent->mountPoint());
@@ -426,7 +434,7 @@ void MountWatcherModule::readDFDone()
                if (descriptionToMountMap[ent->niceDescription()] != ent->mountPoint())
                  name = i18n("%1 [%2]").arg(name).arg(ent->mountPoint());
              }
-				
+
 			mountList<<name;
 			mountList<<ent->deviceName();
 			mountList<<"file:/"+(ent->mountPoint().startsWith("/")?ent->mountPoint().right(ent->mountPoint().length()-1):ent->mountPoint());
@@ -437,6 +445,7 @@ void MountWatcherModule::readDFDone()
 		}
 	}
 	completeList=mountList;
+	networkList=mountList;
 	for (EntryMap::iterator it=mEntryMap.begin();it!=mEntryMap.end();++it)
 	{
 		completeList<<it.data().id;
@@ -466,11 +475,33 @@ void MountWatcherModule::readDFDone()
 		}
 	}
 
+        if ( !triggerUpdate )
+        {
+            if ( networkList.count()!=oldnetworkList.count())
+		triggerUpdate=true;
+            else
+            {
+		QStringList::iterator it1=networkList.begin();
+		QStringList::iterator it2=oldnetworkList.begin();
+		while (it1!=completeList.end())
+		{
+                    if ((*it1)!=(*it2)) {
+                        triggerUpdate=true;
+                        break;
+                    }
+                    ++it1;
+                    ++it2;
+		}
+            }
+
+        }
+
 	if (triggerUpdate)
 	{
 	        KDirNotify_stub allDirNotify("*", "KDirNotify*");
 	        allDirNotify.FilesAdded( KURL( "devices:/" ) );
 	        allDirNotify.FilesAdded( KURL( "system:/" ) );
+			allDirNotify.FilesAdded( KURL( "network:/" ) );
 	} else
 		kdDebug()<<" kiodevices No Update needed"<<endl;
 }
--- kdebase-3.3.2/kioslave/devices/kdedmodule/mountwatcher.h--	2005-02-18 10:26:09.000000000 +0100
+++ kdebase-3.3.2/kioslave/devices/kdedmodule/mountwatcher.h	2005-03-22 15:09:06.723507556 +0100
@@ -53,6 +53,7 @@ private:
     EntryMap mEntryMap;
     QStringList mountList;
     QStringList completeList;
+    QStringList networkList;
     bool firstTime;
     uint mtabsize;
 k_dcop:
@@ -65,6 +66,7 @@ k_dcop:
     bool    mounted(QString name);
     QStringList basicList();
     QStringList basicSystemList();
+    QStringList basicNetworkList();
     QStringList basicDeviceInfo(QString);
     QStringList basicDeviceInfoForMountPoint(QString);
     void addSpecialDevice(const QString& uniqueIdentifier, const QString& description,
--- kdebase-3.3.2/kioslave/devices/kio_devices.cc--	2005-02-18 10:26:09.000000000 +0100
+++ kdebase-3.3.2/kioslave/devices/kio_devices.cc	2005-03-22 15:08:43.108982182 +0100
@@ -56,10 +56,11 @@
 	QStringList deviceInfo(const QString name);
 
 	QStringList kmobile_list( QString deviceName );
-   
+
    private:
 	uint mountpointMappingCount();
 	bool fullMode;
+	bool networkDisplay;
   };
 
   extern "C" {
@@ -78,11 +79,12 @@
 static void createFileEntry(KIO::UDSEntry& entry, const QString& name, const QString& url, const QString& mime);
 static void createDirEntry(KIO::UDSEntry& entry, const QString& name, const QString& url, const QString& mime);
 
-DevicesProtocol::DevicesProtocol( const QCString& protocol, const QCString &pool, const QCString &app): 
+DevicesProtocol::DevicesProtocol( const QCString& protocol, const QCString &pool, const QCString &app):
 		SlaveBase(protocol,  pool, app )
 {
 	kdDebug(7126)<<"Called with slavename: " << protocol << endl;
 	if (protocol=="system") fullMode=true; else fullMode=false;
+        if ( protocol=="network" ) networkDisplay=true; else networkDisplay=false;
 }
 
 DevicesProtocol::~DevicesProtocol()
@@ -168,10 +170,15 @@ void DevicesProtocol::stat(const KURL& u
 	if (url.path().length() <= 1)
 	{
 		KIO::UDSEntry   entry;
-		if (fullMode)
+                if ( !networkDisplay )
+                {
+                    if (fullMode)
 			createDirEntry(entry, i18n("System"), "system:/", "inode/directory");
-		else
+                    else
 			createDirEntry(entry, i18n("Devices"), "devices:/", "inode/directory");
+                }
+                else
+                    createDirEntry(entry, i18n("Devices"), "network:/", "inode/directory");
 		statEntry(entry);
 		finished();
 		return;
@@ -333,19 +340,36 @@ QStringList DevicesProtocol::deviceList(
 	QCString retType;
 	QStringList retVal;
 	QDataStream streamout(param,IO_WriteOnly);
-	
+
 	kdDebug(7126)<<"list dir: Fullmode=="<<fullMode<<endl;
 	QString dcopFun=fullMode?"basicSystemList()":"basicList()";
-	if ( dcopClient()->call( "kded",
-		 "mountwatcher", dcopFun.utf8(), param,retType,data,false ) )
-	{
+        if ( !networkDisplay )
+        {
+            if ( dcopClient()->call( "kded",
+                                     "mountwatcher", dcopFun.utf8(), param,retType,data,false ) )
+            {
 		QDataStream streamin(data,IO_ReadOnly);
 		streamin>>retVal;
-	}
-	else
-	{
+            }
+            else
+            {
 		retVal.append(QString::fromLatin1("!!!ERROR!!!"));
-	}
+            }
+        }
+        else
+        {
+            QString dcopFun="basicNetworkList()";
+            if ( dcopClient()->call( "kded",
+                                     "mountwatcher", dcopFun.utf8(), param,retType,data,false ) )
+            {
+		QDataStream streamin(data,IO_ReadOnly);
+		streamin>>retVal;
+            }
+            else
+            {
+		retVal.append(QString::fromLatin1("!!!ERROR!!!"));
+            }
+        }
 	// add mobile devices info (kmobile)
 	retVal += kmobile_list(QString::null);
 
@@ -507,7 +531,7 @@ static void createDirEntry(KIO::UDSEntry
 	if (mime.startsWith("icon:")) {
 		kdDebug(7126)<<"setting prefered icon:"<<mime.right(mime.length()-5)<<endl;
 		addAtom(entry,KIO::UDS_ICON_NAME,0,mime.right(mime.length()-5));
-		addAtom(entry,KIO::UDS_MIME_TYPE,0,"inode/directory");	
+		addAtom(entry,KIO::UDS_MIME_TYPE,0,"inode/directory");
 	}
 	else {
 		addAtom(entry, KIO::UDS_MIME_TYPE, 0, mime);
--- kdebase-3.3.2/kioslave/devices/Makefile.am--	2005-02-18 10:26:09.000000000 +0100
+++ kdebase-3.3.2/kioslave/devices/Makefile.am	2005-03-22 15:08:30.470703374 +0100
@@ -10,7 +10,7 @@ kio_devices_la_LDFLAGS = $(all_libraries
 
 noinst_HEADERS = kio_devices.h
 
-kdelnk_DATA = devices.protocol system.protocol
+kdelnk_DATA = devices.protocol system.protocol network.protocol
 kdelnkdir = $(kde_servicesdir)
 
 
--- /dev/null	2005-03-03 16:04:02.165955608 +0100
+++ kdebase-3.3.2/kioslave/devices/network.protocol	2005-03-22 15:13:34.000000000 +0100
@@ -0,0 +1,15 @@
+[Protocol]
+exec=kio_devices
+protocol=network
+input=none
+output=filesystem
+listing=Name,Type,Size,Date,Access,Owner,Group,Link,
+reading=true
+writing=false
+makedir=false
+deleting=false
+linking=false
+moving=false
+Icon=kfm
+maxInstances=2
+Class=:local