[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/kio
From: David Faure <faure () kde ! org>
Date: 2004-11-26 12:11:37
Message-ID: 20041126121137.F20A318869 () office ! kde ! org
[Download RAW message or body]
CVS commit by faure:
The plural-form police was there :)
M +23 -11 kio/defaultprogress.cpp 1.67
M +1 -3 misc/uiserver.cpp 1.121
--- kdelibs/kio/misc/uiserver.cpp #1.120:1.121
@@ -265,7 +265,5 @@ void ProgressItem::setProcessedDirs( uns
void ProgressItem::setPercent( unsigned long percent ) {
- QString total = m_iTotalSize ? KIO::convertSize(m_iTotalSize)
- : i18n( "%1 files" ).arg( m_iTotalFiles );
- QString tmps = i18n( "%1 % of %2 ").arg( percent ).arg( total );
+ const QString tmps = KIO::DefaultProgress::makePercentString( percent, m_iTotalSize, m_iTotalFiles );
setText( ListProgress::TB_PROGRESS, tmps );
--- kdelibs/kio/kio/defaultprogress.cpp #1.66:1.67
@@ -228,29 +228,40 @@ void DefaultProgress::showTotals()
}
+//static
+QString DefaultProgress::makePercentString( unsigned long percent,
+ KIO::filesize_t totalSize,
+ unsigned long totalFiles )
+{
+ if ( totalSize )
+ return i18n( "%1 % of %2 " ).arg( percent ).arg( KIO::convertSize( totalSize ) );
+ else if ( totalFiles )
+ return i18n( "%1 % of 1 file", "%1 % of %n files", totalFiles ).arg( percent );
+ else
+ return i18n( "%1 %" ).arg( percent );
+}
+
void DefaultProgress::slotPercent( KIO::Job*, unsigned long percent )
{
- QString total = m_iTotalSize ? KIO::convertSize( m_iTotalSize )
- : i18n( "%1 files" ).arg( m_iTotalFiles );
- QString tmp = i18n( "%1 % of %2 " ).arg( percent ).arg( total );
+ QString caption = makePercentString( percent, m_iTotalSize, m_iTotalFiles );
m_pProgressBar->setValue( percent );
switch(mode) {
case Copy:
- tmp.append(i18n(" (Copying)"));
+ caption.append(i18n(" (Copying)"));
break;
case Move:
- tmp.append(i18n(" (Moving)"));
+ caption.append(i18n(" (Moving)"));
break;
case Delete:
- tmp.append(i18n(" (Deleting)"));
+ caption.append(i18n(" (Deleting)"));
break;
case Create:
- tmp.append(i18n(" (Creating)"));
+ caption.append(i18n(" (Creating)"));
break;
case Done:
- tmp.append(i18n(" (Done)"));
+ caption.append(i18n(" (Done)"));
break;
}
- setCaption( tmp );
+ setCaption( caption );
d->noCaptionYet = false;
}
@@ -269,6 +280,7 @@ void DefaultProgress::slotProcessedSize(
m_iProcessedSize = bytes;
- QString tmp;
- tmp = i18n( "%1 of %2 complete").arg( KIO::convertSize(bytes) ).arg( KIO::convertSize(m_iTotalSize));
+ QString tmp = i18n( "%1 of %2 complete")
+ .arg( KIO::convertSize(bytes) )
+ .arg( KIO::convertSize(m_iTotalSize));
sizeLabel->setText( tmp );
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic