Show a progress information when doing a Nepomuk search. As "sideeffect" some KDE3 relicts for the progress bar code have been removed too...

svn path=/trunk/KDE/kdebase/apps/; revision=1048225
This commit is contained in:
Peter Penz 2009-11-12 22:45:47 +00:00
parent 4f24794fc3
commit 07f31c2087
5 changed files with 34 additions and 40 deletions

View file

@ -1006,6 +1006,12 @@ void DolphinMainWindow::slotTestCanDecode(const QDragMoveEvent* event, bool& can
void DolphinMainWindow::searchItems(const KUrl& url)
{
m_activeViewContainer->setUrl(url);
// The Nepomuk IO-slave does not provide any progress information. Give
// an immediate hint to the user that a searching is done:
DolphinStatusBar* statusBar = m_activeViewContainer->statusBar();
statusBar->setProgressText(i18nc("@info", "Searching..."));
statusBar->setProgress(-1);
}
void DolphinMainWindow::slotTabMoved(int from, int to)

View file

@ -67,7 +67,6 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
QWidget* parent,
const KUrl& url) :
QWidget(parent),
m_showProgress(false),
m_isFolderWritable(false),
m_mainWindow(mainWindow),
m_topLayout(0),
@ -283,30 +282,17 @@ void DolphinViewContainer::updateStatusBar()
void DolphinViewContainer::updateProgress(int percent)
{
if (!m_showProgress) {
// Only show the directory loading progress if the status bar does
// not contain another progress information. This means that
// the directory loading progress information has the lowest priority.
const QString progressText(m_statusBar->progressText());
const QString loadingText(i18nc("@info:progress", "Loading folder..."));
m_showProgress = progressText.isEmpty() || (progressText == loadingText);
if (m_showProgress) {
m_statusBar->setProgressText(loadingText);
m_statusBar->setProgress(0);
}
}
if (m_showProgress) {
m_statusBar->setProgress(percent);
if (m_statusBar->progressText().isEmpty()) {
m_statusBar->setProgressText(i18nc("@info:progress", "Loading folder..."));
}
m_statusBar->setProgress(percent);
}
void DolphinViewContainer::slotDirListerCompleted()
{
if (m_showProgress) {
if (!m_statusBar->progressText().isEmpty()) {
m_statusBar->setProgressText(QString());
m_statusBar->setProgress(100);
m_showProgress = false;
}
updateStatusBar();

View file

@ -253,7 +253,6 @@ private slots:
void slotHistoryChanged();
private:
bool m_showProgress;
bool m_isFolderWritable;
DolphinMainWindow* m_mainWindow;

View file

@ -191,6 +191,9 @@ QString DolphinStatusBar::progressText() const
void DolphinStatusBar::setProgress(int percent)
{
// show a busy indicator if a value < 0 is provided:
m_progressBar->setMaximum((percent < 0) ? 0 : 100);
if (percent < 0) {
percent = 0;
} else if (percent > 100) {
@ -206,7 +209,7 @@ void DolphinStatusBar::setProgress(int percent)
m_progressBar->setValue(m_progress);
if (!m_progressBar->isVisible() || (percent == 100)) {
QTimer::singleShot(300, this, SLOT(updateProgressInfo()));
updateProgressInfo();
}
const QString& defaultText = m_messageLabel->defaultText();
@ -252,24 +255,6 @@ void DolphinStatusBar::resizeEvent(QResizeEvent* event)
QMetaObject::invokeMethod(this, "assureVisibleText", Qt::QueuedConnection);
}
void DolphinStatusBar::updateProgressInfo()
{
const bool isErrorShown = (m_messageLabel->type() == Error);
if (m_progress < 100) {
// show the progress information and hide the extensions
setExtensionsVisible(false);
if (!isErrorShown) {
m_progressText->show();
m_progressBar->show();
}
} else {
// hide the progress information and show the extensions
m_progressText->hide();
m_progressBar->hide();
assureVisibleText();
}
}
void DolphinStatusBar::updateSpaceInfoContent(const KUrl& url)
{
m_spaceInfo->setUrl(url);
@ -322,6 +307,24 @@ void DolphinStatusBar::showZoomSliderToolTip(int zoomLevel)
QApplication::sendEvent(m_zoomSlider, &toolTipEvent);
}
void DolphinStatusBar::updateProgressInfo()
{
const bool isErrorShown = (m_messageLabel->type() == Error);
if (m_progress < 100) {
// show the progress information and hide the extensions
setExtensionsVisible(false);
if (!isErrorShown) {
m_progressText->show();
m_progressBar->show();
}
} else {
// hide the progress information and show the extensions
m_progressText->hide();
m_progressBar->hide();
assureVisibleText();
}
}
void DolphinStatusBar::setExtensionsVisible(bool visible)
{
bool spaceInfoVisible = visible;

View file

@ -127,8 +127,6 @@ protected:
virtual void resizeEvent(QResizeEvent* event);
private slots:
void updateProgressInfo();
/**
* Is invoked, when the URL of the DolphinView, where the
* statusbar belongs too, has been changed. The space information
@ -153,6 +151,8 @@ private slots:
void showZoomSliderToolTip(int zoomLevel);
private:
void updateProgressInfo();
/**
* Makes the space information widget and zoom slider widget
* visible, if \a visible is true and the settings allow to show