Bug 97342

Summary: network filenames end up the same in kprinter
Product: [Applications] kdeprint Reporter: zfavas
Component: generalAssignee: KDEPrint Devel Mailinglist <kde-print-devel>
Status: CLOSED FIXED    
Severity: normal CC: jlayt, l.lunak
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description zfavas 2005-01-18 14:24:42 UTC
Version:            (using KDE KDE 3.3.0)
Installed from:    Debian testing/unstable Packages
OS:                Linux

I was bold enough to drag-and-drop a number of selected files from an smb:// url (konqueror) into kprinter (single drag-and-drop of multiple files).

Unfortunately this single drag-and-drop operation resulted in the same temporary filename in /tmp/kde-xxxxx/kprinteryyyyyy.tmp times the number of the dragged-and-dropped file.
Comment 1 Philip Rodrigues 2006-09-01 16:50:03 UTC
Does the problem happen only for smb:// files, or for all files? I can't reproduce it in KDE 3.5 with local files.
Comment 2 Christoph Burger-Scheidlin 2006-09-09 00:18:35 UTC
I have the problem in kde 3.5.4 for files accessed via smb:/ ftp, ftps and sieve. I did not try any more, but it is safe to assume that it happens for all files that need to be stored in /tmp before they can be printed.

as comment #1 I do NOT have this problem for local files.
Comment 3 Philip Rodrigues 2006-09-11 23:14:48 UTC
Confirmed with ftp on 3.5 branch r581764. I can correctly DnD from konqueror to konqueror, so I suppose the bug is in kprinter: reassigning.
Comment 4 Lubos Lunak 2006-11-03 18:43:10 UTC
SVN commit 601577 by lunakl:

Clean up handling of filenames and urls. Apparently "kde-filelist"
can contain urls, so just use those. Results in less ugly filenames
and fixes incorrect NetAccess::download() usage as a side-effect.
BUG: 97342



 M  +1 -1      kdebase/kdeprint/kprinter/printwrapper.cpp  
 M  +7 -13     kdelibs/kdeprint/kfilelist.cpp  


--- branches/KDE/3.5/kdebase/kdeprint/kprinter/printwrapper.cpp #601576:601577
@@ -304,7 +304,7 @@
 	for (QStringList::ConstIterator it=files.begin(); it!=files.end(); ++it)
 	{
 		QString	tmpFile;
-		KURL	url(*it);
+		KURL	url = KURL::fromPathOrURL(*it);
 		kdDebug( 500 ) << url.url() << endl;
 		if (KIO::NetAccess::download(url, tmpFile, this))
 		{
--- branches/KDE/3.5/kdelibs/kdeprint/kfilelist.cpp #601576:601577
@@ -189,17 +189,12 @@
 		while (item && item->nextSibling())
 			item = item->nextSibling();
 
-		// for each file, download it (if necessary) and add it
-		QString	downloaded;
 		for (KURL::List::ConstIterator it=files.begin(); it!=files.end(); ++it)
-			if (KIO::NetAccess::download(*it, downloaded, this))
-			{
-				KURL	url;
-				url.setPath(downloaded);
-				KMimeType::Ptr	mime = KMimeType::findByURL(url, 0, true, false);
-				item = new QListViewItem(m_files, item, url.fileName(), mime->comment(), downloaded);
-				item->setPixmap(0, mime->pixmap(url, KIcon::Small));
-			}
+		{
+			KMimeType::Ptr	mime = KMimeType::findByURL( *it, 0, true, false);
+			item = new QListViewItem(m_files, item, (*it).fileName(), mime->comment(), (*it).url());
+			item->setPixmap(0, mime->pixmap(*it, KIcon::Small));
+		}
 
 		slotSelectionChanged();
 		/*
@@ -220,10 +215,9 @@
 	QListViewItem *item = 0;
 	for (QStringList::ConstIterator it=files.begin(); it!=files.end(); ++it)
 	{
-		KURL	url;
-		url.setPath(*it);
+		KURL	url = KURL::fromPathOrURL( *it );
 		KMimeType::Ptr	mime = KMimeType::findByURL(url, 0, true, false);
-		item = new QListViewItem(m_files, item, url.fileName(), mime->comment(), *it);
+		item = new QListViewItem(m_files, item, url.fileName(), mime->comment(), url.url());
 		item->setPixmap(0, mime->pixmap(url, KIcon::Small));
 	}
 	slotSelectionChanged();
Comment 5 John Layt 2008-12-31 17:54:19 UTC
Closing old Resolved status bug.