m_shownUrl(),
m_urlCandidate(),
m_fileItem(),
+ m_selection(),
m_nameLabel(0),
m_preview(0),
m_metaDataWidget(0),
void InfoSidebarPage::setSelection(const KFileItemList& selection)
{
- SidebarPage::setSelection(selection);
+ m_selection = selection;
const int count = selection.count();
if (count == 0) {
if (item.isNull()) {
// The cursor is above the viewport. If files are selected,
// show information regarding the selection.
- if (selection().size() > 0) {
+ if (m_selection.size() > 0) {
m_timer->start(TimerDelay);
}
} else if (!item.url().isEmpty()) {
cancelRequest();
- const KFileItemList& selectedItems = selection();
- const KUrl file = (!m_fileItem.isNull() || selectedItems.isEmpty()) ? m_shownUrl : selectedItems[0].url();
+ const KUrl file = (!m_fileItem.isNull() || m_selection.isEmpty()) ? m_shownUrl : m_selection[0].url();
if (!file.isValid()) {
return;
}
- const int selectionCount = selectedItems.count();
+ const int selectionCount = m_selection.count();
if (m_fileItem.isNull() && (selectionCount > 1)) {
KIconLoader iconLoader;
QPixmap icon = iconLoader.loadIcon("dialog-information",
{
m_metaTextLabel->clear();
- const KFileItemList& selectedItems = selection();
- if ((selectedItems.size() <= 1) || !m_fileItem.isNull()) {
+ if ((m_selection.size() <= 1) || !m_fileItem.isNull()) {
KFileItem fileItem;
if (m_fileItem.isNull()) {
// no pending request is ongoing
- const KUrl url = (selectedItems.size() == 1) ? selectedItems.first().url() : m_shownUrl;
+ const KUrl url = (m_selection.size() == 1) ? m_selection.first().url() : m_shownUrl;
fileItem = KFileItem(KFileItem::Unknown, KFileItem::Unknown, url);
fileItem.refresh();
} else {
} else {
if (m_metaDataWidget != 0) {
KUrl::List urls;
- foreach (const KFileItem& item, selectedItems) {
+ foreach (const KFileItem& item, m_selection) {
urls.append(item.targetUrl());
}
m_metaDataWidget->setFiles(urls);
}
unsigned long int totalSize = 0;
- foreach (const KFileItem& item, selectedItems) {
+ foreach (const KFileItem& item, m_selection) {
// Only count the size of files, not dirs to match what
// DolphinViewContainer::selectionStatusBarText() does.
if (!item.isDir() && !item.isLink()) {
/** @see SidebarPage::setUrl() */
virtual void setUrl(const KUrl& url);
- /** @see SidebarPage::setSelection() */
- virtual void setSelection(const KFileItemList& selection);
+ /**
+ * This is invoked to inform the sidebar that the user has selected a new
+ * set of items.
+ */
+ void setSelection(const KFileItemList& selection);
/**
* Does a delayed request of information for the item \a item.
KUrl m_shownUrl; // URL that is shown as info
KUrl m_urlCandidate; // URL candidate that will replace m_shownURL after a delay
KFileItem m_fileItem; // file item for m_shownUrl if available (otherwise null)
+ KFileItemList m_selection;
QLabel* m_nameLabel;
PixmapViewer* m_preview;
class SidebarPage : public QWidget
{
Q_OBJECT
+
public:
explicit SidebarPage(QWidget* parent = 0);
virtual ~SidebarPage();
/** Returns the current set URL of the active Dolphin view. */
const KUrl& url() const;
- /** Returns the current selected items of the active Dolphin view. */
- const KFileItemList& selection() const;
-
public slots:
/**
* This is invoked every time the folder being displayed in the
*/
virtual void setUrl(const KUrl& url);
- /**
- * This is invoked to inform the sidebar that the user has selected a new
- * set of items.
- */
- virtual void setSelection(const KFileItemList& selection);
-
private:
KUrl m_url;
- KFileItemList m_currentSelection;
};
#endif // _SIDEBARPAGE_H_