Document properties: remove toggle button

Simply shows the full path, file name can be extracted from it.
The button did not toggle between title and file path, also 
because title is always shown if found.

svn path=/trunk/KDE/kdegraphics/okular/; revision=1152390
remotes/origin/KDE/4.6
Luigi Toscano 16 years ago
parent 89968298a5
commit b3eda791f4
  1. 47
      ui/propertiesdialog.cpp
  2. 7
      ui/propertiesdialog.h

@ -59,8 +59,6 @@ PropertiesDialog::PropertiesDialog(QWidget *parent, Okular::Document *doc)
return; return;
} }
m_showingTitle = true;
// mime name based on mimetype id // mime name based on mimetype id
QString mimeName = info->get( "mimeType" ).section( '/', -1 ).toUpper(); QString mimeName = info->get( "mimeType" ).section( '/', -1 ).toUpper();
setCaption( i18n( "%1 Properties", mimeName ) ); setCaption( i18n( "%1 Properties", mimeName ) );
@ -70,11 +68,9 @@ PropertiesDialog::PropertiesDialog(QWidget *parent, Okular::Document *doc)
int row = 0; int row = 0;
int valMaxWidth = 100; int valMaxWidth = 100;
const QString filePathKey = Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::FilePath );
/* obtains the properties list, conveniently ordered */ /* obtains the properties list, conveniently ordered */
QStringList orderedProperties; QStringList orderedProperties;
orderedProperties << filePathKey orderedProperties << Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::FilePath )
<< Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::PagesSize ) << Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::PagesSize )
<< Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::DocumentSize ); << Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::DocumentSize );
for (Okular::DocumentInfo::Key ks = Okular::DocumentInfo::Title; for (Okular::DocumentInfo::Key ks = Okular::DocumentInfo::Title;
@ -108,23 +104,7 @@ PropertiesDialog::PropertiesDialog(QWidget *parent, Okular::Document *doc)
// create labels and layout them // create labels and layout them
KSqueezedTextLabel *value = new KSqueezedTextLabel( valueString, page ); KSqueezedTextLabel *value = new KSqueezedTextLabel( valueString, page );
QWidget *key; QWidget *key = new QLabel( i18n( "%1:", titleString ), page );
if ( element.tagName() == filePathKey ) {
m_toggleTitlePath = new QPushButton( page );
m_toggleTitlePath->setToolTip( i18n("Toggles between File Path and Title") );
setToggleTitlePathText();
m_toggleTitlePath->setFlat( true );
connect( m_toggleTitlePath, SIGNAL( clicked() ), this, SLOT( filePathViewChanged() ) );
key = m_toggleTitlePath;
m_filePathNameLabel = value;
m_filePathName = valueString;
KUrl vurl( valueString );
value->setText( vurl.fileName() );
} else {
key = new QLabel( i18n( "%1:", titleString ), page );
}
value->setTextInteractionFlags( Qt::TextSelectableByMouse ); value->setTextInteractionFlags( Qt::TextSelectableByMouse );
layout->addWidget( key, row, 0, Qt::AlignRight ); layout->addWidget( key, row, 0, Qt::AlignRight );
layout->addWidget( value, row, 1 ); layout->addWidget( value, row, 1 );
@ -205,29 +185,6 @@ void PropertiesDialog::pageChanged( KPageWidgetItem *current, KPageWidgetItem *
} }
} }
void PropertiesDialog::setToggleTitlePathText()
{
QString text;
if (m_showingTitle)
{
text = i18nc( "%1 is \"Title\"", "%1:", Okular::DocumentInfo::getKeyTitle( Okular::DocumentInfo::Title ) );
}
else
{
text = i18nc( "%1 is \"File Path\"", "%1:", Okular::DocumentInfo::getKeyTitle( Okular::DocumentInfo::FilePath ) );
}
m_toggleTitlePath->setText( text );
}
void PropertiesDialog::filePathViewChanged()
{
m_showingTitle = !m_showingTitle;
setToggleTitlePathText();
QString tmp(m_filePathName);
m_filePathName = m_filePathNameLabel->text();
m_filePathNameLabel->setText( tmp );
}
void PropertiesDialog::slotFontReadingProgress( int page ) void PropertiesDialog::slotFontReadingProgress( int page )
{ {
m_fontProgressBar->setValue( m_fontProgressBar->maximum() * ( page + 1 ) / m_document->pages() ); m_fontProgressBar->setValue( m_fontProgressBar->maximum() * ( page + 1 ) / m_document->pages() );

@ -36,25 +36,18 @@ class PropertiesDialog : public KPageDialog
private slots: private slots:
void pageChanged( KPageWidgetItem *, KPageWidgetItem * ); void pageChanged( KPageWidgetItem *, KPageWidgetItem * );
void filePathViewChanged();
void slotFontReadingProgress( int page ); void slotFontReadingProgress( int page );
void slotFontReadingEnded(); void slotFontReadingEnded();
void reallyStartFontReading(); void reallyStartFontReading();
void showFontsMenu(const QPoint &pos); void showFontsMenu(const QPoint &pos);
private: private:
void setToggleTitlePathText();
Okular::Document * m_document; Okular::Document * m_document;
KPageWidgetItem * m_fontPage; KPageWidgetItem * m_fontPage;
FontsListModel * m_fontModel; FontsListModel * m_fontModel;
QLabel * m_fontInfo; QLabel * m_fontInfo;
QProgressBar * m_fontProgressBar; QProgressBar * m_fontProgressBar;
bool m_fontScanStarted; bool m_fontScanStarted;
bool m_showingTitle;
QString m_filePathName;
KSqueezedTextLabel *m_filePathNameLabel;
QPushButton *m_toggleTitlePath;
}; };
class FontsListModel class FontsListModel

Loading…
Cancel
Save