this, SLOT(openNewTab(KUrl)));
connect(view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)),
this, SLOT(openContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)));
- connect(view, SIGNAL(startedDirLoading(KUrl)),
+ connect(view, SIGNAL(dirLoadingStarted()),
this, SLOT(enableStopAction()));
- connect(view, SIGNAL(finishedDirLoading(KUrl)),
+ connect(view, SIGNAL(dirLoadingCompleted()),
this, SLOT(disableStopAction()));
connect(view, SIGNAL(goBackRequested()),
this, SLOT(goBack()));
if (okClicked && !pattern.isEmpty()) {
QRegExp patternRegExp(pattern, Qt::CaseSensitive, QRegExp::Wildcard);
- m_view->setItemSelectionEnabled(patternRegExp, selectItems);
+ m_view->selectItems(patternRegExp, selectItems);
}
}
bool DolphinPartFileInfoExtension::hasSelection() const
{
- return part()->view()->hasSelection();
+ return part()->view()->selectedItemsCount() > 0;
}
KParts::FileInfoExtension::QueryModes DolphinPartFileInfoExtension::supportedQueryModes() const
connect(m_view, SIGNAL(infoMessage(QString)), this, SLOT(showInfoMessage(QString)));
connect(m_view, SIGNAL(itemActivated(KFileItem)), this, SLOT(slotItemActivated(KFileItem)));
connect(m_view, SIGNAL(redirection(KUrl,KUrl)), this, SLOT(redirect(KUrl,KUrl)));
- connect(m_view, SIGNAL(startedDirLoading(KUrl)), this, SLOT(slotStartedDirLoading()));
- connect(m_view, SIGNAL(finishedDirLoading(KUrl)), this, SLOT(slotFinishedDirLoading()));
+ connect(m_view, SIGNAL(dirLoadingStarted()), this, SLOT(slotDirLoadingStarted()));
+ connect(m_view, SIGNAL(dirLoadingCompleted()), this, SLOT(slotDirLoadingCompleted()));
connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(delayedStatusBarUpdate()));
connect(m_view, SIGNAL(dirLoadingProgress(int)), this, SLOT(updateDirLoadingProgress(int)));
connect(m_view, SIGNAL(dirSortingProgress(int)), this, SLOT(updateSortingProgress(int)));
m_statusBar->setProgress(percent);
}
-void DolphinViewContainer::slotStartedDirLoading()
+void DolphinViewContainer::slotDirLoadingStarted()
{
if (isSearchUrl(url())) {
// Search KIO-slaves usually don't provide any progress information. Give
}
}
-void DolphinViewContainer::slotFinishedDirLoading()
+void DolphinViewContainer::slotDirLoadingCompleted()
{
if (!m_statusBar->progressText().isEmpty()) {
m_statusBar->setProgressText(QString());
* Updates the statusbar to show an undetermined progress with the correct
* context information whether a searching or a directory loading is done.
*/
- void slotStartedDirLoading();
+ void slotDirLoadingStarted();
/**
* Assures that the viewport position is restored and updates the
* statusbar to reflect the current content.
*/
- void slotFinishedDirLoading();
+ void slotDirLoadingCompleted();
/**
* Handles clicking on an item. If the item is a directory, the
m_currentItemUrl = url;
}
-void DolphinView::setItemSelectionEnabled(const QRegExp& pattern, bool enabled)
+void DolphinView::selectItems(const QRegExp& pattern, bool enabled)
{
const KItemListSelectionManager::SelectionMode mode = enabled
? KItemListSelectionManager::Select
return fileItemModel()->nameFilter();
}
-void DolphinView::calculateItemCount(int& fileCount,
- int& folderCount,
- KIO::filesize_t& totalFileSize) const
-{
- const KFileItemModel* model = fileItemModel();
- const int itemCount = model->count();
- for (int i = 0; i < itemCount; ++i) {
- const KFileItem item = model->fileItem(i);
- if (item.isDir()) {
- ++folderCount;
- } else {
- ++fileCount;
- totalFileSize += item.size();
- }
- }
-}
-
QString DolphinView::statusBarText() const
{
QString summary;
int fileCount = 0;
KIO::filesize_t totalFileSize = 0;
- if (hasSelection()) {
+ if (m_container->controller()->selectionManager()->hasSelection()) {
// Give a summary of the status of the selected files
const KFileItemList list = selectedItems();
foreach (const KFileItem& item, list) {
stream << fileItemModel()->expandedUrls();
}
-bool DolphinView::hasSelection() const
-{
- return m_container->controller()->selectionManager()->hasSelection();
-}
-
KFileItem DolphinView::rootItem() const
{
return fileItemModel()->rootItem();
}
}
+void DolphinView::calculateItemCount(int& fileCount,
+ int& folderCount,
+ KIO::filesize_t& totalFileSize) const
+{
+ const KFileItemModel* model = fileItemModel();
+ const int itemCount = model->count();
+ for (int i = 0; i < itemCount; ++i) {
+ const KFileItem item = model->fileItem(i);
+ if (item.isDir()) {
+ ++folderCount;
+ } else {
+ ++fileCount;
+ totalFileSize += item.size();
+ }
+ }
+}
+
void DolphinView::showHoverInformation(const KFileItem& item)
{
emit requestItemInfo(item);
emit writeStateChanged(m_isFolderWritable);
}
- emit startedDirLoading(url());
+ emit dirLoadingStarted();
}
void DolphinView::slotDirLoadingCompleted()
{
- // Update the view-state. This has to be done using a Qt::QueuedConnection
+ // Update the view-state. This has to be done asynchronously
// because the view might not be in its final state yet.
QTimer::singleShot(0, this, SLOT(updateViewState()));
- emit finishedDirLoading(url());
+ emit dirLoadingCompleted();
updateWritableState();
}
* All items that match to the pattern \a pattern will get selected
* if \a enabled is true and deselected if \a enabled is false.
*/
- void setItemSelectionEnabled(const QRegExp& pattern, bool enabled);
+ void selectItems(const QRegExp& pattern, bool enabled);
/**
* Sets the zoom level to \a level. It is assured that the used
void setZoomLevel(int level);
int zoomLevel() const;
- /**
- * Returns true, if zooming in is possible. If false is returned,
- * the maximum zooming level has been reached.
- */
- bool isZoomInPossible() const;
-
- /**
- * Returns true, if zooming out is possible. If false is returned,
- * the minimum zooming level has been reached.
- */
- bool isZoomOutPossible() const;
-
void setSortRole(const QByteArray& role);
QByteArray sortRole() const;
/** Returns the additional information which should be shown for the items. */
QList<QByteArray> visibleRoles() const;
- /** Reloads the current directory. */
void reload();
-
void stopLoading();
/**
void setNameFilter(const QString& nameFilter);
QString nameFilter() const;
- /**
- * Calculates the number of currently shown files into
- * \a fileCount and the number of folders into \a folderCount.
- * The size of all files is written into \a totalFileSize.
- * It is recommend using this method instead of asking the
- * directory lister or the model directly, as it takes
- * filtering and hierarchical previews into account.
- */
- void calculateItemCount(int& fileCount, int& folderCount, KIO::filesize_t& totalFileSize) const;
-
/**
* Returns a textual representation of the state of the current
* folder or selected items, suitable for use in the status bar.
*/
void saveState(QDataStream& stream);
- /** Returns true, if at least one item is selected. */
- bool hasSelection() const;
-
/**
* Returns the root item which represents the current URL.
*/
/**
* Is emitted after DolphinView::setUrl() has been invoked and
- * the directory \a url is currently loaded. If this signal is emitted,
+ * the current directory is loaded. If this signal is emitted,
* it is assured that the view contains already the correct root
* URL and property settings.
*/
- void startedDirLoading(const KUrl& url);
+ void dirLoadingStarted();
/**
* Is emitted after the directory triggered by DolphinView::setUrl()
* has been loaded.
*/
- void finishedDirLoading(const KUrl& url);
+ void dirLoadingCompleted();
/**
* Is emitted after DolphinView::setUrl() has been invoked and provides
*/
void dirSortingProgress(int percent);
- /**
- * Is emitted if the DolphinView::setUrl() is invoked but the URL is not
- * a directory.
- */
- void urlIsFileError(const KUrl& file);
-
/**
* Emitted when the file-item-model emits redirection.
* Testcase: fish://localhost
void hideToolTip();
+ /**
+ * Calculates the number of currently shown files into
+ * \a fileCount and the number of folders into \a folderCount.
+ * The size of all files is written into \a totalFileSize.
+ * It is recommend using this method instead of asking the
+ * directory lister or the model directly, as it takes
+ * filtering and hierarchical previews into account.
+ */
+ void calculateItemCount(int& fileCount, int& folderCount, KIO::filesize_t& totalFileSize) const;
+
private:
KFileItemModel* fileItemModel() const;