views/dolphinfileitemlistwidget.cpp
views/dolphinitemlistview.cpp
views/dolphinnewfilemenuobserver.cpp
- views/dolphinplacesmodel.cpp
views/dolphinremoteencoding.cpp
views/dolphinview.cpp
views/dolphinviewactionhandler.cpp
#include <QClipboard>
#include <QDir>
-#include "views/dolphinplacesmodel.h"
#include "views/dolphinview.h"
#include "views/viewmodecontroller.h"
emptyTrashAction->setEnabled(!trashConfig.group("Status").readEntry("Empty", true));
m_popup->addAction(emptyTrashAction);
- QAction* addToPlacesAction = m_popup->addAction(KIcon("bookmark-new"),
- i18nc("@action:inmenu Add current folder to places", "Add to Places"));
-
- // Don't show if url is already in places
- if (placeExists(m_mainWindow->activeViewContainer()->url())) {
- addToPlacesAction->setVisible(false);
- }
-
addCustomActions();
QAction* propertiesAction = m_mainWindow->actionCollection()->action("properties");
addShowMenuBarAction();
- QAction *action = m_popup->exec(m_pos);
- if (action == emptyTrashAction) {
+ if (m_popup->exec(m_pos) == emptyTrashAction) {
KonqOperations::emptyTrash(m_mainWindow);
- } else if (action == addToPlacesAction) {
- const KUrl url = m_mainWindow->activeViewContainer()->url();
- if (url.isValid()) {
- DolphinPlacesModel::instance()->addPlace(i18nc("@label", "Trash"), url);
- }
}
}
if (activatedAction == addToPlacesAction) {
const KUrl selectedUrl(m_fileInfo.url());
if (selectedUrl.isValid()) {
- DolphinPlacesModel::instance()->addPlace(placesName(selectedUrl),
- selectedUrl);
+ KFilePlacesModel model;
+ model.addPlace(placesName(selectedUrl), selectedUrl);
}
} else if (activatedAction == openParentInNewWindowAction) {
m_command = OpenParentFolderInNewWindow;
if (addToPlacesAction && (action == addToPlacesAction)) {
const KUrl url = m_mainWindow->activeViewContainer()->url();
if (url.isValid()) {
- DolphinPlacesModel::instance()->addPlace(placesName(url), url);
+ KFilePlacesModel model;
+ model.addPlace(placesName(url), url);
}
}
}
bool DolphinContextMenu::placeExists(const KUrl& url) const
{
- const KFilePlacesModel* placesModel = DolphinPlacesModel::instance();
- const int count = placesModel->rowCount();
+ KFilePlacesModel model;
+ const int count = model.rowCount();
for (int i = 0; i < count; ++i) {
- const QModelIndex index = placesModel->index(i, 0);
-
- if (url.equals(placesModel->url(index), KUrl::CompareWithoutTrailingSlash)) {
+ const QModelIndex index = model.index(i, 0);
+ if (url.equals(model.url(index), KUrl::CompareWithoutTrailingSlash)) {
return true;
}
}
#include <KUrlComboBox>
#include <KToolInvocation>
-#include "views/dolphinplacesmodel.h"
-
#include <QDesktopWidget>
#include <QDBusMessage>
#include <QKeyEvent>
m_updateToolBarTimer(0),
m_lastHandleUrlStatJob(0)
{
- DolphinPlacesModel::setModel(new KFilePlacesModel(this));
- connect(DolphinPlacesModel::instance(), SIGNAL(errorMessage(QString)),
- this, SLOT(showErrorMessage(QString)));
-
// Workaround for a X11-issue in combination with KModifierInfo
// (see DolphinContextMenu::initializeModifierKeyInfo() for
// more information):
#include "filterbar/filterbar.h"
#include "search/dolphinsearchbox.h"
#include "statusbar/dolphinstatusbar.h"
-#include "views/dolphinplacesmodel.h"
#include "views/draganddrophelper.h"
#include "views/viewmodecontroller.h"
#include "views/viewproperties.h"
m_topLayout->setSpacing(0);
m_topLayout->setMargin(0);
- m_urlNavigator = new KUrlNavigator(DolphinPlacesModel::instance(), url, this);
+ m_urlNavigator = new KUrlNavigator(new KFilePlacesModel(this), url, this);
connect(m_urlNavigator, SIGNAL(urlsDropped(KUrl,QDropEvent*)),
this, SLOT(dropUrls(KUrl,QDropEvent*)));
connect(m_urlNavigator, SIGNAL(activated()),
#include "filemetadataconfigurationdialog.h"
#include "phononwidget.h"
#include "pixmapviewer.h"
-#include "views/dolphinplacesmodel.h"
InformationPanelContent::InformationPanelContent(QWidget* parent) :
QWidget(parent),
m_phononWidget(0),
m_nameLabel(0),
m_metaDataWidget(0),
- m_metaDataArea(0)
+ m_metaDataArea(0),
+ m_placesModel(0)
{
parent->installEventFilter(this);
layout->addWidget(m_nameLabel);
layout->addWidget(new KSeparator());
layout->addWidget(m_metaDataArea);
+
+ m_placesModel = new KFilePlacesModel(this);
}
InformationPanelContent::~InformationPanelContent()
bool InformationPanelContent::applyPlace(const KUrl& url)
{
- KFilePlacesModel* placesModel = DolphinPlacesModel::instance();
- const int count = placesModel->rowCount();
-
+ const int count = m_placesModel->rowCount();
for (int i = 0; i < count; ++i) {
- QModelIndex index = placesModel->index(i, 0);
-
- if (url.equals(placesModel->url(index), KUrl::CompareWithoutTrailingSlash)) {
- setNameLabelText(placesModel->text(index));
- m_preview->setPixmap(placesModel->icon(index).pixmap(128, 128));
+ QModelIndex index = m_placesModel->index(i, 0);
+ if (url.equals(m_placesModel->url(index), KUrl::CompareWithoutTrailingSlash)) {
+ setNameLabelText(m_placesModel->text(index));
+ m_preview->setPixmap(m_placesModel->icon(index).pixmap(128, 128));
return true;
}
}
class KFileItemList;
class KFileMetaDataWidget;
+class KFilePlacesModel;
class PhononWidget;
class PixmapViewer;
class QPixmap;
QLabel* m_nameLabel;
KFileMetaDataWidget* m_metaDataWidget;
QScrollArea* m_metaDataArea;
+
+ KFilePlacesModel* m_placesModel;
};
#endif // INFORMATIONPANELCONTENT_H
initializeAvailableDevices();
loadBookmarks();
- const int syncBookmarksTimeout = 1000;
+ const int syncBookmarksTimeout = 100;
m_saveBookmarksTimer = new QTimer(this);
m_saveBookmarksTimer->setInterval(syncBookmarksTimeout);
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2011 by Peter Penz <peter.penz19@gmail.com> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
- ***************************************************************************/
-
-#include "dolphinplacesmodel.h"
-
-#include <KFilePlacesModel>
-
-KFilePlacesModel* DolphinPlacesModel::m_filePlacesModel = 0;
-
-KFilePlacesModel* DolphinPlacesModel::instance()
-{
- return m_filePlacesModel;
-}
-
-void DolphinPlacesModel::setModel(KFilePlacesModel* model)
-{
- m_filePlacesModel = model;
-}
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2011 by Peter Penz <peter.penz19@gmail.com> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
- ***************************************************************************/
-
-#ifndef DOLPHIN_PLACES_MODEL_H
-#define DOLPHIN_PLACES_MODEL_H
-
-#include <libdolphin_export.h>
-
-class KFilePlacesModel;
-
-/**
- * @brief Allows global access to the places-model of Dolphin
- * that is shown in the "Places" panel.
- */
-class LIBDOLPHINPRIVATE_EXPORT DolphinPlacesModel
-{
-public:
- static KFilePlacesModel* instance();
-
-private:
- static void setModel(KFilePlacesModel* model);
- static KFilePlacesModel* m_filePlacesModel;
-
- friend class DolphinMainWindow; // Sets the model with setModel()
-};
-
-#endif