[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2006-11-03 17:42:03
Message-ID: 1162575723.205598.2227.nullmailer () svn ! kde ! org
[Download RAW message or body]

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();
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic