diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 9 | ||||
| -rw-r--r-- | src/dolphinmainwindow.cpp | 12 | ||||
| -rw-r--r-- | src/dolphinmainwindow.h | 5 | ||||
| -rw-r--r-- | src/dolphinnewfilemenu.cpp | 1 | ||||
| -rw-r--r-- | src/dolphinviewcontainer.cpp | 27 | ||||
| -rw-r--r-- | src/dolphinviewcontainer.h | 12 | ||||
| -rw-r--r-- | src/kitemviews/kitemlistcontroller.cpp | 11 | ||||
| -rw-r--r-- | src/kitemviews/kstandarditemlistwidget.cpp | 28 | ||||
| -rw-r--r-- | src/main.cpp | 10 | ||||
| -rw-r--r-- | src/panels/panel.cpp | 5 | ||||
| -rw-r--r-- | src/panels/panel.h | 5 | ||||
| -rw-r--r-- | src/panels/places/placesitemmodel.cpp | 4 | ||||
| -rw-r--r-- | src/panels/places/placespanel.cpp | 13 | ||||
| -rw-r--r-- | src/panels/places/placespanel.h | 3 | ||||
| -rw-r--r-- | src/search/dolphinsearchbox.cpp | 21 | ||||
| -rw-r--r-- | src/search/dolphinsearchbox.h | 3 | ||||
| -rw-r--r-- | src/views/dolphinview.cpp | 8 |
17 files changed, 149 insertions, 28 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1c6b40c4b..b7eec5a65 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,7 +6,7 @@ configure_file(config-nepomuk.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-nepomuk macro_bool_to_01(X11_Xrender_FOUND HAVE_XRENDER) configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h ) -include_directories( ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ) +include_directories( ${KACTIVITIES_INCLUDE_DIRS} ) if (Nepomuk_FOUND) # Yes, Soprano includes is what we need here @@ -241,6 +241,13 @@ if (Nepomuk_FOUND) ) endif (Nepomuk_FOUND) +if (KActivities_FOUND) + target_link_libraries( + kdeinit_dolphin + ${KACTIVITIES_LIBRARY} + ) +endif (KActivities_FOUND) + install(TARGETS kdeinit_dolphin ${INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS dolphin ${INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 17268297c..3bf3b3f55 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1560,12 +1560,12 @@ void DolphinMainWindow::setupActions() KToggleAction* editableLocation = actionCollection()->add<KToggleAction>("editable_location"); editableLocation->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location")); - editableLocation->setShortcut(Qt::CTRL | Qt::Key_L); + editableLocation->setShortcut(Qt::Key_F6); connect(editableLocation, SIGNAL(triggered()), this, SLOT(toggleEditLocation())); KAction* replaceLocation = actionCollection()->addAction("replace_location"); replaceLocation->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location")); - replaceLocation->setShortcut(Qt::Key_F6); + replaceLocation->setShortcut(Qt::CTRL | Qt::Key_L); connect(replaceLocation, SIGNAL(triggered()), this, SLOT(replaceLocation())); // setup 'Go' menu @@ -1704,7 +1704,7 @@ void DolphinMainWindow::setupDockWidgets() connect(foldersPanel, SIGNAL(folderActivated(KUrl)), this, SLOT(changeUrl(KUrl))); connect(foldersPanel, SIGNAL(folderMiddleClicked(KUrl)), - this, SLOT(openNewActivatedTab(KUrl))); + this, SLOT(openNewTab(KUrl))); connect(foldersPanel, SIGNAL(errorMessage(QString)), this, SLOT(slotPanelErrorMessage(QString))); @@ -1756,13 +1756,15 @@ void DolphinMainWindow::setupDockWidgets() connect(placesPanel, SIGNAL(placeActivated(KUrl)), this, SLOT(changeUrl(KUrl))); connect(placesPanel, SIGNAL(placeMiddleClicked(KUrl)), - this, SLOT(openNewActivatedTab(KUrl))); + this, SLOT(openNewTab(KUrl))); connect(placesPanel, SIGNAL(errorMessage(QString)), this, SLOT(slotPanelErrorMessage(QString))); connect(this, SIGNAL(urlChanged(KUrl)), placesPanel, SLOT(setUrl(KUrl))); connect(placesDock, SIGNAL(visibilityChanged(bool)), this, SLOT(slotPlacesPanelVisibilityChanged(bool))); + connect(this, SIGNAL(settingsChanged()), + placesPanel, SLOT(readSettings())); // Add actions into the "Panels" menu KActionMenu* panelsMenu = new KActionMenu(i18nc("@action:inmenu View", "Panels"), this); @@ -1953,6 +1955,8 @@ void DolphinMainWindow::refreshViews() toggleSplitView(); } } + + emit settingsChanged(); } void DolphinMainWindow::clearStatusBar() diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index ab79fb0e6..7da5801ff 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -151,6 +151,11 @@ signals: */ void requestItemInfo(const KFileItem& item); + /** + * Is emitted if the settings have been changed. + */ + void settingsChanged(); + protected: /** @see QWidget::showEvent() */ virtual void showEvent(QShowEvent* event); diff --git a/src/dolphinnewfilemenu.cpp b/src/dolphinnewfilemenu.cpp index 30d79c670..9d9baabe2 100644 --- a/src/dolphinnewfilemenu.cpp +++ b/src/dolphinnewfilemenu.cpp @@ -22,7 +22,6 @@ #include "dolphinmainwindow.h" #include "dolphinviewcontainer.h" -#include "statusbar/dolphinstatusbar.h" #include "views/dolphinnewfilemenuobserver.h" #include "views/dolphinview.h" diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 31c82d606..8a566cffd 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -44,6 +44,10 @@ #include <KUrlNavigator> #include <KRun> +#ifdef KActivities_FOUND +#include <KActivities/ResourceInstance> +#endif + #include "dolphin_generalsettings.h" #include "filterbar/filterbar.h" #include "search/dolphinsearchbox.h" @@ -64,6 +68,9 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) : m_statusBarTimer(0), m_statusBarTimestamp(), m_autoGrabFocus(true) +#ifdef KActivities_FOUND + , m_activityResourceInstance(0) +#endif { hide(); @@ -157,6 +164,14 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) : m_topLayout->addWidget(m_statusBar); setSearchModeEnabled(isSearchUrl(url)); + + // Initialize kactivities resource instance + + #ifdef KActivities_FOUND + m_activityResourceInstance = new KActivities::ResourceInstance( + window()->winId(), url); + m_activityResourceInstance->setParent(this); + #endif } DolphinViewContainer::~DolphinViewContainer() @@ -172,6 +187,14 @@ void DolphinViewContainer::setActive(bool active) { m_urlNavigator->setActive(active); m_view->setActive(active); + + #ifdef KActivities_FOUND + if (active) { + m_activityResourceInstance->notifyFocusedIn(); + } else { + m_activityResourceInstance->notifyFocusedOut(); + } + #endif } bool DolphinViewContainer::isActive() const @@ -338,6 +361,10 @@ void DolphinViewContainer::setUrl(const KUrl& newUrl) if (newUrl != m_urlNavigator->locationUrl()) { m_urlNavigator->setLocationUrl(newUrl); } + + #ifdef KActivities_FOUND + m_activityResourceInstance->setUri(newUrl); + #endif } void DolphinViewContainer::setFilterBarVisible(bool visible) diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h index fd52806d9..8a0309b0c 100644 --- a/src/dolphinviewcontainer.h +++ b/src/dolphinviewcontainer.h @@ -31,6 +31,13 @@ #include <QWidget> #include <views/dolphinview.h> +#include <config-apps.h> + +#ifdef KActivities_FOUND +namespace KActivities { + class ResourceInstance; +} +#endif class FilterBar; class KMessageWidget; @@ -308,6 +315,11 @@ private: QTimer* m_statusBarTimer; // Triggers a delayed update QElapsedTimer m_statusBarTimestamp; // Time in ms since last update bool m_autoGrabFocus; + +#ifdef KActivities_FOUND +private: + KActivities::ResourceInstance * m_activityResourceInstance; +#endif }; #endif // DOLPHINVIEWCONTAINER_H diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp index 41a86324b..5a7175e4c 100644 --- a/src/kitemviews/kitemlistcontroller.cpp +++ b/src/kitemviews/kitemlistcontroller.cpp @@ -489,7 +489,16 @@ void KItemListController::slotAutoActivationTimeout() return; } - if (m_model->supportsDropping(index)) { + /* m_view->isUnderMouse() fixes a bug in the Folder-View-Panel and in the + * Places-Panel. + * + * Bug: When you drag a file onto a Folder-View-Item or a Places-Item and + * then move away before the auto-activation timeout triggers, than the + * item still becomes activated/expanded. + * + * See Bug 293200 and 305783 + */ + if (m_model->supportsDropping(index) && m_view->isUnderMouse()) { if (m_view->supportsItemExpanding() && m_model->isExpandable(index)) { const bool expanded = m_model->isExpanded(index); m_model->setExpanded(index, !expanded); diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp index 72d10cf40..97c8a038b 100644 --- a/src/kitemviews/kstandarditemlistwidget.cpp +++ b/src/kitemviews/kstandarditemlistwidget.cpp @@ -68,6 +68,14 @@ QSizeF KStandardItemListWidgetInformant::itemSizeHint(int index, const KItemList const qreal maxWidth = itemWidth - 2 * option.padding; QTextLine line; + int emptyRolesCount = 0; + foreach (const QByteArray& role, view->visibleRoles()) { + const QString text = roleText(role, values); + if (role != "text" && role != "rating" && text.isEmpty()) { + emptyRolesCount++; + } + } + // Calculate the number of lines required for wrapping the name QTextOption textOption(Qt::AlignHCenter); textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); @@ -84,7 +92,7 @@ QSizeF KStandardItemListWidgetInformant::itemSizeHint(int index, const KItemList layout.endLayout(); // Add one line for each additional information - textHeight += additionalRolesCount * option.fontMetrics.lineSpacing(); + textHeight += (additionalRolesCount - emptyRolesCount) * option.fontMetrics.lineSpacing(); const qreal maxTextHeight = option.maxTextSize.height(); if (maxTextHeight > 0 && textHeight > maxTextHeight) { @@ -980,8 +988,17 @@ void KStandardItemListWidget::updateIconsLayoutTextCache() qreal nameHeight = 0; QTextLine line; + int emptyRolesCount = 0; + foreach (const QByteArray& role, visibleRoles()) { + const QString text = roleText(role, values); + if (role != "text" && role != "rating" && text.isEmpty()) { + emptyRolesCount++; + } + } + const int additionalRolesCount = qMax(visibleRoles().count() - 1, 0); - const int maxNameLines = (option.maxTextSize.height() / int(lineSpacing)) - additionalRolesCount; + const int maxNameLines = (option.maxTextSize.height() / int(lineSpacing)) - + (additionalRolesCount - emptyRolesCount); QTextLayout layout(nameTextInfo->staticText.text(), m_customizedFont); layout.setTextOption(nameTextInfo->staticText.textOption()); @@ -1015,7 +1032,7 @@ void KStandardItemListWidget::updateIconsLayoutTextCache() nameTextInfo->staticText.setTextWidth(maxWidth); nameTextInfo->pos = QPointF(padding, widgetHeight - nameHeight - - additionalRolesCount * lineSpacing - + (additionalRolesCount - emptyRolesCount)* lineSpacing - padding); m_textRect = QRectF(padding + (maxWidth - nameWidth) / 2, nameTextInfo->pos.y(), @@ -1030,6 +1047,11 @@ void KStandardItemListWidget::updateIconsLayoutTextCache() } const QString text = roleText(role, values); + + if (role != "text" && role != "rating" && text.isEmpty()) { + continue; + } + TextInfo* textInfo = m_textInfo.value(role); textInfo->staticText.setText(text); diff --git a/src/main.cpp b/src/main.cpp index 39ecee8b8..cfaaa7480 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -36,14 +36,14 @@ KDE_EXPORT int kdemain(int argc, char **argv) "2.1", ki18nc("@title", "File Manager"), KAboutData::License_GPL, - ki18nc("@info:credit", "(C) 2006-2012 Peter Penz")); + ki18nc("@info:credit", "(C) 2006-2012 Peter Penz and Frank Reininghaus")); about.setHomepage("http://dolphin.kde.org"); - about.addAuthor(ki18nc("@info:credit", "Peter Penz"), - ki18nc("@info:credit", "Maintainer and developer"), - "[email protected]"); about.addAuthor(ki18nc("@info:credit", "Frank Reininghaus"), - ki18nc("@info:credit", "Developer"), + ki18nc("@info:credit", "Maintainer (since 2012) and developer"), + about.addAuthor(ki18nc("@info:credit", "Peter Penz"), + ki18nc("@info:credit", "Maintainer and developer (2006-2012)"), + "[email protected]"); about.addAuthor(ki18nc("@info:credit", "Sebastian Trüg"), ki18nc("@info:credit", "Developer"), diff --git a/src/panels/panel.cpp b/src/panels/panel.cpp index c2681ecfb..14b7c0230 100644 --- a/src/panels/panel.cpp +++ b/src/panels/panel.cpp @@ -71,4 +71,9 @@ void Panel::setUrl(const KUrl& url) } } +void Panel::readSettings() +{ + +} + #include "panel.moc" diff --git a/src/panels/panel.h b/src/panels/panel.h index 064e1f362..a0b25d6cc 100644 --- a/src/panels/panel.h +++ b/src/panels/panel.h @@ -60,6 +60,11 @@ public slots: */ void setUrl(const KUrl& url); + /** + * Refreshes the view to get synchronized with the settings. + */ + virtual void readSettings(); + protected: /** * Must be implemented by derived classes and is invoked when diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 706092bc7..4770c6b10 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -54,7 +54,7 @@ #include <Nepomuk/ResourceManager> #include <Nepomuk/Query/ComparisonTerm> #include <Nepomuk/Query/LiteralTerm> - #include <Nepomuk/Query/Query> + #include <Nepomuk/Query/FileQuery> #include <Nepomuk/Query/ResourceTypeTerm> #include <Nepomuk/Vocabulary/NFO> #include <Nepomuk/Vocabulary/NIE> @@ -1172,7 +1172,7 @@ KUrl PlacesItemModel::createSearchUrl(const KUrl& url) #ifdef HAVE_NEPOMUK KUrl PlacesItemModel::searchUrlForTerm(const Nepomuk::Query::Term& term) { - const Nepomuk::Query::Query query(term); + const Nepomuk::Query::FileQuery query(term); return query.toSearchUrl(); } #endif diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index 4b28c8510..e483f9b83 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -23,6 +23,8 @@ #include "placespanel.h" +#include "dolphin_generalsettings.h" + #include <KDebug> #include <KDirNotify> #include <KIcon> @@ -78,6 +80,14 @@ bool PlacesPanel::urlChanged() return true; } +void PlacesPanel::readSettings() +{ + if (m_controller) { + const int delay = GeneralSettings::autoExpandFolders() ? 750 : -1; + m_controller->setAutoActivationDelay(delay); + } +} + void PlacesPanel::showEvent(QShowEvent* event) { if (event->spontaneous()) { @@ -101,6 +111,9 @@ void PlacesPanel::showEvent(QShowEvent* event) m_controller = new KItemListController(m_model, view, this); m_controller->setSelectionBehavior(KItemListController::SingleSelection); m_controller->setSingleClickActivation(true); + + readSettings(); + connect(m_controller, SIGNAL(itemActivated(int)), this, SLOT(slotItemActivated(int))); connect(m_controller, SIGNAL(itemMiddleClicked(int)), this, SLOT(slotItemMiddleClicked(int))); connect(m_controller, SIGNAL(itemContextMenuRequested(int,QPointF)), this, SLOT(slotItemContextMenuRequested(int,QPointF))); diff --git a/src/panels/places/placespanel.h b/src/panels/places/placespanel.h index 989a0916b..7951cdd9c 100644 --- a/src/panels/places/placespanel.h +++ b/src/panels/places/placespanel.h @@ -50,6 +50,9 @@ protected: virtual bool urlChanged(); virtual void showEvent(QShowEvent* event); +public slots: + virtual void readSettings(); + private slots: void slotItemActivated(int index); void slotItemMiddleClicked(int index); diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index 28f1f1af5..6f1c736b0 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -239,10 +239,9 @@ void DolphinSearchBox::slotReturnPressed(const QString& text) void DolphinSearchBox::slotFacetsButtonToggled() { - const bool visible = !m_facetsWidget->isVisible(); - m_facetsWidget->setVisible(visible); - SearchSettings::setShowFacetsWidget(visible); - updateFacetsToggleButtonIcon(); + const bool facetsIsVisible = !m_facetsWidget->isVisible(); + m_facetsWidget->setVisible(facetsIsVisible); + updateFacetsToggleButton(); } void DolphinSearchBox::slotFacetChanged() @@ -281,6 +280,7 @@ void DolphinSearchBox::saveSettings() { SearchSettings::setLocation(m_fromHereButton->isChecked() ? "FromHere" : "Everywhere"); SearchSettings::setWhat(m_fileNameButton->isChecked() ? "FileName" : "Content"); + SearchSettings::setShowFacetsWidget(m_facetsToggleButton->isChecked()); SearchSettings::self()->writeConfig(); } @@ -343,7 +343,8 @@ void DolphinSearchBox::init() // Create "Facets" widgets m_facetsToggleButton = new QToolButton(this); - m_facetsToggleButton->setAutoRaise(true); + m_facetsToggleButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + initButton(m_facetsToggleButton); connect(m_facetsToggleButton, SIGNAL(clicked()), this, SLOT(slotFacetsButtonToggled())); m_facetsWidget = new DolphinFacetsWidget(this); @@ -390,7 +391,7 @@ void DolphinSearchBox::init() m_startSearchTimer->setInterval(1000); connect(m_startSearchTimer, SIGNAL(timeout()), this, SLOT(emitSearchRequest())); - updateFacetsToggleButtonIcon(); + updateFacetsToggleButton(); applyReadOnlyState(); } @@ -467,10 +468,12 @@ void DolphinSearchBox::applyReadOnlyState() } } -void DolphinSearchBox::updateFacetsToggleButtonIcon() +void DolphinSearchBox::updateFacetsToggleButton() { - const bool visible = SearchSettings::showFacetsWidget(); - m_facetsToggleButton->setIcon(KIcon(visible ? "list-remove" : "list-add")); + const bool facetsIsVisible = SearchSettings::showFacetsWidget(); + m_facetsToggleButton->setChecked(facetsIsVisible ? true : false); + m_facetsToggleButton->setIcon(KIcon(facetsIsVisible ? "arrow-up-double" : "arrow-down-double")); + m_facetsToggleButton->setText(facetsIsVisible ? i18nc("action:button", "Less Options") : i18nc("action:button", "More Options")); } #include "dolphinsearchbox.moc" diff --git a/src/search/dolphinsearchbox.h b/src/search/dolphinsearchbox.h index ee9987a38..f3cc535d6 100644 --- a/src/search/dolphinsearchbox.h +++ b/src/search/dolphinsearchbox.h @@ -133,8 +133,7 @@ private: void applyReadOnlyState(); - void updateFacetsToggleButtonIcon(); - + void updateFacetsToggleButton(); private: bool m_startedSearching; bool m_readOnly; diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index f0dc3caba..05849729f 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -792,6 +792,14 @@ void DolphinView::slotItemsActivated(const QSet<int>& indexes) items.append(m_model->fileItem(index)); } + if (items.count() > 5) { + QString question = QString("Are you sure you want to open %1 items?").arg(items.count()); + const int answer = KMessageBox::warningYesNo(this, question); + if (answer != KMessageBox::Yes) { + return; + } + } + foreach (const KFileItem& item, items) { if (item.isDir()) { emit tabRequested(item.url()); |
