#include "filterbar.h"
#include "kurlnavigator.h"
#include "viewproperties.h"
-#include "dolphinsettings.h"
+#include "settings/dolphinsettings.h"
#include "dolphin_generalsettings.h"
DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
const KUrl& url) :
QWidget(parent),
m_showProgress(false),
+ m_isFolderWritable(false),
m_mainWindow(mainWindow),
m_topLayout(0),
m_urlNavigator(0),
m_proxyModel);
connect(m_view, SIGNAL(urlChanged(const KUrl&)),
m_urlNavigator, SLOT(setUrl(const KUrl&)));
- connect(m_view, SIGNAL(requestContextMenu(KFileItem, const KUrl&)),
- this, SLOT(openContextMenu(KFileItem, const KUrl&)));
+ connect(m_view, SIGNAL(requestContextMenu(KFileItem, const KUrl&, const QList<QAction*>&)),
+ this, SLOT(openContextMenu(KFileItem, const KUrl&, const QList<QAction*>&)));
connect(m_view, SIGNAL(contentsMoved(int, int)),
this, SLOT(saveContentsPos(int, int)));
connect(m_view, SIGNAL(requestItemInfo(KFileItem)),
// Temporary disable the 'File'->'Create New...' menu until
// the write permissions can be checked in a fast way at
// DolphinViewContainer::slotDirListerCompleted().
- m_mainWindow->newMenu()->menu()->setEnabled(false);
+ m_isFolderWritable = false;
+ if (isActive()) {
+ m_mainWindow->newMenu()->menu()->setEnabled(false);
+ }
}
}
{
m_urlNavigator->setActive(active);
m_view->setActive(active);
+ if (active) {
+ m_mainWindow->newMenu()->menu()->setEnabled(m_isFolderWritable);
+ }
}
bool DolphinViewContainer::isActive() const
// Enable the 'File'->'Create New...' menu only if the directory
// supports writing.
- KMenu* createNew = m_mainWindow->newMenu()->menu();
KFileItem item = m_dirLister->rootItem();
if (item.isNull()) {
// it is unclear whether writing is supported
- createNew->setEnabled(true);
+ m_isFolderWritable = true;
} else {
KonqFileItemCapabilities capabilities(KFileItemList() << item);
- createNew->setEnabled(capabilities.supportsWriting());
+ m_isFolderWritable = capabilities.supportsWriting();
+ }
+
+ if (isActive()) {
+ m_mainWindow->newMenu()->menu()->setEnabled(m_isFolderWritable);
}
}
}
void DolphinViewContainer::openContextMenu(const KFileItem& item,
- const KUrl& url)
+ const KUrl& url,
+ const QList<QAction*>& customActions)
{
DolphinContextMenu contextMenu(m_mainWindow, item, url);
+ contextMenu.setCustomActions(customActions);
contextMenu.open();
}
{
if (KProtocolManager::supportsListing(url)) {
m_view->updateView(url, m_urlNavigator->savedRootUrl());
+ if (isActive()) {
+ // When an URL has been entered, the view should get the focus.
+ // The focus must be requested asynchronously, as changing the URL might create
+ // a new view widget. Using QTimer::singleShow() works reliable, however
+ // QMetaObject::invokeMethod() with a queued connection does not work, which might
+ // indicate that we should pass a hint to DolphinView::updateView()
+ // regarding the focus instead. To test: Enter an URL and press CTRL+Enter.
+ // Expected result: The view should get the focus.
+ QTimer::singleShot(0, this, SLOT(requestFocus()));
+ }
} else if (KProtocolManager::isSourceProtocol(url)) {
QString app = "konqueror";
if (url.protocol().startsWith(QLatin1String("http"))) {
} else {
showErrorMessage(i18nc("@info:status", "Invalid protocol"));
}
-
- if (isActive()) {
- // When an URL has been entered, the view should get the focus.
- // The focus must be requested asynchronously, as changing the URL might create
- // a new view widget. Using QTimer::singleShow() works reliable, however
- // QMetaObject::invokeMethod() with a queued connection does not work, which might
- // indicate that we should pass a hint to DolphinView::updateView()
- // regarding the focus instead. To test: Enter an URL and press CTRL+Enter.
- // Expected result: The view should get the focus.
- QTimer::singleShot(0, this, SLOT(requestFocus()));
- }
}
void DolphinViewContainer::saveRootUrl(const KUrl& url)