Bug 142906 - Caption should ommit file://
Summary: Caption should ommit file://
Status: RESOLVED FIXED
Alias: None
Product: kpdf
Classification: Applications
Component: general (show other bugs)
Version: 0.5.6
Platform: Fedora RPMs Linux
: NOR wishlist
Target Milestone: ---
Assignee: Albert Astals Cid
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-13 09:39 UTC by leon pollak
Modified: 2007-03-13 22:12 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description leon pollak 2007-03-13 09:39:01 UTC
Version:           0.5.6 (using KDE KDE 3.5.6)
Installed from:    Fedora RPMs
OS:                Linux

Usually, during the work, I have 5-6 pdf files opened simultaneously, so that the size of each button in the desktop panel is relatively small. Each button has the icon of PDF and the opened files name. But the file name is invisible, because it starts with file://xxx and 'file://' consumes all the space of the button.

I tried to do the following - reopened each file manually, via the File->Open menu and this did the job. Now all buttons contain the readable file names. But when I restarted Linux, I again see 'file://'.

It will be great if the caption (and the button) will be able to filter out this 'file://' prefix.

Best Regards
Comment 1 Albert Astals Cid 2007-03-13 22:12:31 UTC
SVN commit 642287 by aacid:

Fix emision of window caption for remote files and for kpdf windows restored by the session manager
BUGS: 142906


 M  +19 -0     part.cpp  
 M  +1 -0      part.h  
 M  +0 -3      shell/shell.cpp  


--- branches/KDE/3.5/kdegraphics/kpdf/part.cpp #642286:642287
@@ -89,6 +89,10 @@
 	// connect the started signal to tell the job the mimetypes we like
 	connect(this, SIGNAL(started(KIO::Job *)), this, SLOT(setMimeTypes(KIO::Job *)));
 	
+	// connect the completed signal so we can put the window caption when loading remote files
+	connect(this, SIGNAL(completed()), this, SLOT(emitWindowCaption()));
+	connect(this, SIGNAL(canceled(const QString &)), this, SLOT(emitWindowCaption()));
+	
 	// load catalog for translation
 	KGlobal::locale()->insertCatalogue("kpdf");
 
@@ -460,10 +464,18 @@
 
     // this calls the above 'openURL' method
     bool b = KParts::ReadOnlyPart::openURL(url);
+
+    // these setWindowCaption calls only work for local files
     if ( !b )
+    {
         KMessageBox::error( widget(), i18n("Could not open %1").arg( url.prettyURL() ) );
+        emit setWindowCaption("");
+    }
     else
+    {
         m_viewportDirty.pageNumber = -1;
+        emit setWindowCaption(url.filename());
+    }
     emit enablePrintAction(b);
     return b;
 }
@@ -482,6 +494,13 @@
 	m_jobMime = mime;
 }
 
+void Part::emitWindowCaption()
+{
+    // these setWindowCaption call only works for remote files
+    if (m_document->isOpened()) emit setWindowCaption(url().filename());
+    else emit setWindowCaption("");
+}
+
 bool Part::closeURL()
 {
     if (!m_temporaryLocalFile.isNull())
--- branches/KDE/3.5/kdegraphics/kpdf/part.h #642286:642287
@@ -121,6 +121,7 @@
 	void saveSplitterSize();
 	void setMimeTypes(KIO::Job *job);
 	void readMimeType(KIO::Job *job, const QString &mime);
+	void emitWindowCaption();
 
 public slots:
 	// connected to Shell action (and browserExtension), not local one
--- branches/KDE/3.5/kdegraphics/kpdf/shell/shell.cpp #642286:642287
@@ -118,10 +118,7 @@
     {
         bool openOk = m_part->openURL( url );
         if ( openOk )
-        {
           m_recent->addURL( url );
-          setCaption(url.fileName());
-        }
         else
           m_recent->removeURL( url );
     }