emit activeViewChanged();
}
-void Dolphin::dropURLs(const KUrl::List& urls,
+void Dolphin::dropUrls(const KUrl::List& urls,
const KUrl& destination)
{
int selectedIndex = -1;
case 0: {
// 'Move Here' has been selected
updateViewProperties(urls);
- moveURLs(urls, destination);
+ moveUrls(urls, destination);
break;
}
case 1: {
// 'Copy Here' has been selected
updateViewProperties(urls);
- copyURLs(urls, destination);
+ copyUrls(urls, destination);
break;
}
updateHistory();
}
-void Dolphin::slotURLChanged(const KUrl& url)
+void Dolphin::slotUrlChanged(const KUrl& url)
{
updateEditActions();
updateGoActions();
setCaption(url.fileName());
}
-void Dolphin::slotURLChangeRequest(const KUrl& url)
+void Dolphin::slotUrlChangeRequest(const KUrl& url)
{
clearStatusBar();
- m_activeView->setURL(url);
+ m_activeView->setUrl(url);
}
void Dolphin::slotViewModeChanged()
updateEditActions();
assert(m_view[PrimaryIdx] != 0);
- int selectedURLsCount = m_view[PrimaryIdx]->selectedURLs().count();
+ int selectedUrlsCount = m_view[PrimaryIdx]->selectedUrls().count();
if (m_view[SecondaryIdx] != 0) {
- selectedURLsCount += m_view[SecondaryIdx]->selectedURLs().count();
+ selectedUrlsCount += m_view[SecondaryIdx]->selectedUrls().count();
}
KAction* compareFilesAction = actionCollection()->action("compare_files");
- compareFilesAction->setEnabled(selectedURLsCount == 2);
+ compareFilesAction->setEnabled(selectedUrlsCount == 2);
m_activeView->updateStatusBar();
void Dolphin::saveProperties(KConfig* config)
{
config->setGroup("Primary view");
- config->writeEntry("URL", m_view[PrimaryIdx]->url().url());
- config->writeEntry("Editable URL", m_view[PrimaryIdx]->isURLEditable());
+ config->writeEntry("Url", m_view[PrimaryIdx]->url().url());
+ config->writeEntry("Editable Url", m_view[PrimaryIdx]->isUrlEditable());
if (m_view[SecondaryIdx] != 0) {
config->setGroup("Secondary view");
- config->writeEntry("URL", m_view[SecondaryIdx]->url().url());
- config->writeEntry("Editable URL", m_view[SecondaryIdx]->isURLEditable());
+ config->writeEntry("Url", m_view[SecondaryIdx]->url().url());
+ config->writeEntry("Editable Url", m_view[SecondaryIdx]->isUrlEditable());
}
}
void Dolphin::readProperties(KConfig* config)
{
config->setGroup("Primary view");
- m_view[PrimaryIdx]->setURL(config->readEntry("URL"));
- m_view[PrimaryIdx]->setURLEditable(config->readBoolEntry("Editable URL"));
+ m_view[PrimaryIdx]->setUrl(config->readEntry("Url"));
+ m_view[PrimaryIdx]->setUrlEditable(config->readBoolEntry("Editable Url"));
if (config->hasGroup("Secondary view")) {
config->setGroup("Secondary view");
if (m_view[SecondaryIdx] == 0) {
toggleSplitView();
}
- m_view[SecondaryIdx]->setURL(config->readEntry("URL"));
- m_view[SecondaryIdx]->setURLEditable(config->readBoolEntry("Editable URL"));
+ m_view[SecondaryIdx]->setUrl(config->readEntry("Url"));
+ m_view[SecondaryIdx]->setUrlEditable(config->readBoolEntry("Editable Url"));
}
else if (m_view[SecondaryIdx] != 0) {
toggleSplitView();
clearStatusBar();
DolphinStatusBar* statusBar = m_activeView->statusBar();
- const KUrl baseURL(m_activeView->url());
+ const KUrl baseUrl(m_activeView->url());
QString name(i18n("New Folder"));
- baseURL.path(KUrl::AddTrailingSlash);
+ baseUrl.path(KUrl::AddTrailingSlash);
- if (baseURL.isLocalFile() && QFileInfo(baseURL.path(KUrl::AddTrailingSlash) + name).exists()) {
- name = KIO::RenameDlg::suggestName(baseURL, i18n("New Folder"));
+ if (baseUrl.isLocalFile() && QFileInfo(baseUrl.path(KUrl::AddTrailingSlash) + name).exists()) {
+ name = KIO::RenameDlg::suggestName(baseUrl, i18n("New Folder"));
}
bool ok = false;
}
else {
name = KIO::encodeFileName(name);
- url = baseURL;
+ url = baseUrl;
url.addPath(name);
}
ok = KIO::NetAccess::mkdir(url, this);
// TODO: provide message type hint
if (ok) {
- statusBar->setMessage(i18n("Created folder %1.").arg(url.path()),
+ statusBar->setMessage(i18n("Created folder %1.",url.path()),
DolphinStatusBar::OperationCompleted);
DolphinCommand command(DolphinCommand::CreateFolder, KUrl::List(), url);
// Creating of the folder has been failed. Check whether the creating
// has been failed because a folder with the same name exists...
if (KIO::NetAccess::exists(url, true, this)) {
- statusBar->setMessage(i18n("A folder named %1 already exists.").arg(url.path()),
+ statusBar->setMessage(i18n("A folder named %1 already exists.",url.path()),
DolphinStatusBar::Error);
}
else {
- statusBar->setMessage(i18n("Creating of folder %1 failed.").arg(url.path()),
+ statusBar->setMessage(i18n("Creating of folder %1 failed.",url.path()),
DolphinStatusBar::Error);
}
}
// Get the source path of the template which should be copied.
- // The source path is part of the URL entry of the desktop file.
+ // The source path is part of the Url entry of the desktop file.
const int pos = entry.templatePath.findRev('/');
QString sourcePath(entry.templatePath.left(pos + 1));
- sourcePath += KDesktopFile(entry.templatePath, true).readPathEntry("URL");
+ sourcePath += KDesktopFile(entry.templatePath, true).readPathEntry("Url");
QString name(i18n(entry.name.ascii()));
// Most entry names end with "..." (e. g. "HTML File..."), which is ok for
// Check whether a file with the current name already exists. If yes suggest automatically
// a unique file name (e. g. "HTML File" will be replaced by "HTML File_1").
- const KUrl viewURL(m_activeView->url());
- const bool fileExists = viewURL.isLocalFile() &&
- QFileInfo(viewURL.path(KUrl::AddTrailingSlash) + KIO::encodeFileName(name)).exists();
+ const KUrl viewUrl(m_activeView->url());
+ const bool fileExists = viewUrl.isLocalFile() &&
+ QFileInfo(viewUrl.path(KUrl::AddTrailingSlash) + KIO::encodeFileName(name)).exists();
if (fileExists) {
- name = KIO::RenameDlg::suggestName(viewURL, name);
+ name = KIO::RenameDlg::suggestName(viewUrl, name);
}
// let the user change the suggested file name
// before copying the template to the destination path check whether a file
// with the given name already exists
- const QString destPath(viewURL.pathOrUrl() + "/" + KIO::encodeFileName(name));
- const KUrl destURL(destPath);
- if (KIO::NetAccess::exists(destURL, false, this)) {
- statusBar->setMessage(i18n("A file named %1 already exists.").arg(name),
+ const QString destPath(viewUrl.pathOrUrl() + "/" + KIO::encodeFileName(name));
+ const KUrl destUrl(destPath);
+ if (KIO::NetAccess::exists(destUrl, false, this)) {
+ statusBar->setMessage(i18n("A file named %1 already exists.",name),
DolphinStatusBar::Error);
return;
}
// copy the template to the destination path
- const KUrl sourceURL(sourcePath);
- KIO::CopyJob* job = KIO::copyAs(sourceURL, destURL);
+ const KUrl sourceUrl(sourcePath);
+ KIO::CopyJob* job = KIO::copyAs(sourceUrl, destUrl);
job->setDefaultPermissions(true);
if (KIO::NetAccess::synchronousRun(job, this)) {
- statusBar->setMessage(i18n("Created file %1.").arg(name),
+ statusBar->setMessage(i18n("Created file %1.",name),
DolphinStatusBar::OperationCompleted);
KUrl::List list;
- list.append(sourceURL);
- DolphinCommand command(DolphinCommand::CreateFile, list, destURL);
+ list.append(sourceUrl);
+ DolphinCommand command(DolphinCommand::CreateFile, list, destUrl);
UndoManager::instance().addCommand(command);
}
else {
- statusBar->setMessage(i18n("Creating of file %1 failed.").arg(name),
+ statusBar->setMessage(i18n("Creating of file %1 failed.",name),
DolphinStatusBar::Error);
}
}
void Dolphin::moveToTrash()
{
clearStatusBar();
- KUrl::List selectedURLs = m_activeView->selectedURLs();
- KIO::Job* job = KIO::trash(selectedURLs);
- addPendingUndoJob(job, DolphinCommand::Trash, selectedURLs, m_activeView->url());
+ KUrl::List selectedUrls = m_activeView->selectedUrls();
+ KIO::Job* job = KIO::trash(selectedUrls);
+ addPendingUndoJob(job, DolphinCommand::Trash, selectedUrls, m_activeView->url());
}
void Dolphin::deleteItems()
{
clearStatusBar();
- KUrl::List list = m_activeView->selectedURLs();
+ KUrl::List list = m_activeView->selectedUrls();
const uint itemCount = list.count();
assert(itemCount >= 1);
QString text;
if (itemCount > 1) {
- text = i18n("Do you really want to delete the %1 selected items?").arg(itemCount);
+ text = i18n("Do you really want to delete the %1 selected items?",itemCount);
}
else {
const KUrl& url = list.first();
- text = i18n("Do you really want to delete '%1'?").arg(url.fileName());
+ text = i18n("Do you really want to delete '%1'?",url.fileName());
}
const bool del = KMessageBox::warningContinueCancel(this,
void Dolphin::cut()
{
m_clipboardContainsCutData = true;
- /* KDE4-TODO: Q3DragObject* data = new KURLDrag(m_activeView->selectedURLs(),
+ /* KDE4-TODO: Q3DragObject* data = new KUrlDrag(m_activeView->selectedUrls(),
widget());
QApplication::clipboard()->setData(data);*/
}
{
m_clipboardContainsCutData = false;
/* KDE4-TODO:
- Q3DragObject* data = new KUrlDrag(m_activeView->selectedURLs(),
+ Q3DragObject* data = new KUrlDrag(m_activeView->selectedUrls(),
widget());
QApplication::clipboard()->setData(data);*/
}
clearStatusBar();
- KUrl::List sourceURLs;
- KUrlDrag::decode(data, sourceURLs);
+ KUrl::List sourceUrls;
+ KUrlDrag::decode(data, sourceUrls);
- // per default the pasting is done into the current URL of the view
- KUrl destURL(m_activeView->url());
+ // per default the pasting is done into the current Url of the view
+ KUrl destUrl(m_activeView->url());
// check whether the pasting should be done into a selected directory
- KUrl::List selectedURLs = m_activeView->selectedURLs();
- if (selectedURLs.count() == 1) {
+ KUrl::List selectedUrls = m_activeView->selectedUrls();
+ if (selectedUrls.count() == 1) {
const KFileItem fileItem(S_IFDIR,
KFileItem::Unknown,
- selectedURLs.first(),
+ selectedUrls.first(),
true);
if (fileItem.isDir()) {
// only one item is selected which is a directory, hence paste
// into this directory
- destURL = selectedURLs.first();
+ destUrl = selectedUrls.first();
}
}
- updateViewProperties(sourceURLs);
+ updateViewProperties(sourceUrls);
if (m_clipboardContainsCutData) {
- moveURLs(sourceURLs, destURL);
+ moveUrls(sourceUrls, destUrl);
m_clipboardContainsCutData = false;
clipboard->clear();
}
else {
- copyURLs(sourceURLs, destURL);
+ copyUrls(sourceUrls, destUrl);
}*/
}
//}
if (pasteAction->isEnabled()) {
- KUrl::List urls = m_activeView->selectedURLs();
+ KUrl::List urls = m_activeView->selectedUrls();
const uint count = urls.count();
if (count > 1) {
// pasting should not be allowed when more than one file
bool editOrBrowse = action->isChecked();
// action->setChecked(action->setChecked);
- m_activeView->setURLEditable(editOrBrowse);
+ m_activeView->setUrlEditable(editOrBrowse);
}
void Dolphin::editLocation()
{
KToggleAction* action = static_cast<KToggleAction*>(actionCollection()->action("editable_location"));
action->setChecked(true);
- m_activeView->setURLEditable(true);
+ m_activeView->setUrlEditable(true);
}
void Dolphin::adjustViewProperties()
KUrl urlA;
KUrl urlB;
- KUrl::List urls = m_view[PrimaryIdx]->selectedURLs();
+ KUrl::List urls = m_view[PrimaryIdx]->selectedUrls();
switch (urls.count()) {
case 0: {
assert(m_view[SecondaryIdx] != 0);
- urls = m_view[SecondaryIdx]->selectedURLs();
+ urls = m_view[SecondaryIdx]->selectedUrls();
assert(urls.count() == 2);
urlA = urls[0];
urlB = urls[1];
case 1: {
urlA = urls[0];
assert(m_view[SecondaryIdx] != 0);
- urls = m_view[SecondaryIdx]->selectedURLs();
+ urls = m_view[SecondaryIdx]->selectedUrls();
assert(urls.count() == 1);
urlB = urls[0];
break;
DolphinCommand command = (*it).command;
if (command.type() == DolphinCommand::Trash) {
// To be able to perform an undo for the 'Move to Trash' operation
- // all source URLs must be updated with the trash URL. E. g. when moving
+ // all source Urls must be updated with the trash Url. E. g. when moving
// a file "test.txt" and a second file "test.txt" to the trash,
// then the filenames in the trash are "0-test.txt" and "1-test.txt".
QMap<QString, QString> metaData = job->metaData();
- KUrl::List newSourceURLs;
+ KUrl::List newSourceUrls;
- KUrl::List sourceURLs = command.source();
- KUrl::List::Iterator sourceIt = sourceURLs.begin();
- const KUrl::List::Iterator sourceEnd = sourceURLs.end();
+ KUrl::List sourceUrls = command.source();
+ KUrl::List::Iterator sourceIt = sourceUrls.begin();
+ const KUrl::List::Iterator sourceEnd = sourceUrls.end();
while (sourceIt != sourceEnd) {
- QMap<QString, QString>::ConstIterator metaIt = metaData.find("trashURL-" + (*sourceIt).path());
+ QMap<QString, QString>::ConstIterator metaIt = metaData.find("trashUrl-" + (*sourceIt).path());
if (metaIt != metaData.end()) {
- newSourceURLs.append(KUrl(metaIt.data()));
+ newSourceUrls.append(KUrl(metaIt.data()));
}
++sourceIt;
}
- command.setSource(newSourceURLs);
+ command.setSource(newSourceUrls);
}
UndoManager::instance().addCommand(command);
assert(manager != 0);
KBookmarkGroup root = manager->root();
if (root.first().isNull()) {
- root.addBookmark(manager, i18n("Home"), settings.generalSettings()->homeURL(), "folder_home");
+ root.addBookmark(manager, i18n("Home"), settings.generalSettings()->homeUrl(), "folder_home");
root.addBookmark(manager, i18n("Storage Media"), KUrl("media:/"), "blockdevice");
root.addBookmark(manager, i18n("Network"), KUrl("remote:/"), "network_local");
root.addBookmark(manager, i18n("Root"), KUrl("/"), "folder_red");
setupActions();
setupGUI(Keys|Save|Create|ToolBar);
- const KUrl& homeURL = root.first().url();
- setCaption(homeURL.fileName());
- ViewProperties props(homeURL);
+ const KUrl& homeUrl = root.first().url();
+ setCaption(homeUrl.fileName());
+ ViewProperties props(homeUrl);
m_view[PrimaryIdx] = new DolphinView(m_splitter,
- homeURL,
+ homeUrl,
props.viewMode(),
props.isShowHiddenFilesEnabled());
void Dolphin::setupActions()
{
// setup 'File' menu
- //KAction* createFolder = new KAction(i18n("Folder..."), "Ctrl+N",
- // this, SLOT(createFolder()),
- // actionCollection(), "create_folder");
KAction* createFolder = new KAction(i18n("Folder..."), actionCollection(), "create_folder");
createFolder->setIcon(KIcon("folder"));
createFolder->setShortcut(Qt::Key_N);
connect(createFolder, SIGNAL(triggered()), this, SLOT(createFolder()));
- //new KAction(i18n("Rename"), KKey(Key_F2),
- // this, SLOT(rename()),
- // actionCollection(), "rename");
KAction* rename = new KAction(i18n("Rename"), actionCollection(), "rename");
rename->setShortcut(Qt::Key_F2);
connect(rename, SIGNAL(triggered()), this, SLOT(rename()));
- //KAction* moveToTrashAction = new KAction(i18n("Move to Trash"), KKey(Key_Delete),
- // this, SLOT(moveToTrash()),
- // actionCollection(), "move_to_trash");
- //moveToTrashAction->setIcon("edittrash");
KAction* moveToTrash = new KAction(i18n("Move to Trash"), actionCollection(), "move_to_trash");
moveToTrash->setIcon(KIcon("edittrash"));
moveToTrash->setShortcut(QKeySequence::Delete);
connect(moveToTrash, SIGNAL(triggered()), this, SLOT(moveToTrash()));
- //KAction* deleteAction = new KAction(i18n("Delete"), "Shift+Delete",
- // this, SLOT(deleteItems()),
- // actionCollection(), "delete");
- //deleteAction->setIcon("editdelete");
KAction* deleteAction = new KAction(i18n("Delete"), actionCollection(), "delete");
deleteAction->setShortcut(Qt::ALT | Qt::Key_Delete);
deleteAction->setIcon(KIcon("editdelete"));
connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteItems()));
- //new KAction(i18n("Propert&ies"), "Alt+Return",
- // this, SLOT(properties()),
- // actionCollection(), "properties");
KAction* properties = new KAction(i18n("Propert&ies"), actionCollection(), "properties");
properties->setShortcut(Qt::Key_Alt | Qt::Key_Return);
connect(properties, SIGNAL(triggered()), this, SLOT(properties()));
KStdAction::copy(this, SLOT(copy()), actionCollection());
KStdAction::paste(this, SLOT(paste()), actionCollection());
- //new KAction(i18n("Select All"), "Ctrl+A",
- // this, SLOT(selectAll()),
- // actionCollection(), "select_all");
KAction* selectAll = new KAction(i18n("Select All"), actionCollection(), "select_all");
selectAll->setShortcut(Qt::CTRL + Qt::Key_A);
connect(selectAll, SIGNAL(triggered()), this, SLOT(selectAll()));
- //new KAction(i18n("Invert Selection"), "Ctrl+Shift+A",
- // this, SLOT(invertSelection()),
- // actionCollection(), "invert_selection");
KAction* invertSelection = new KAction(i18n("Invert Selection"), actionCollection(), "invert_selection");
invertSelection->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_A);
connect(invertSelection, SIGNAL(triggered()), this, SLOT(invertSelection()));
SLOT(zoomOut()),
actionCollection());
- //KAction* iconsView = new KRadioAction(i18n("Icons"), "Ctrl+1",
- // this, SLOT(setIconsView()),
- // actionCollection(), "icons");
- KAction* iconsView = new KAction(i18n("Icons"), actionCollection(), "icons");
+ KToggleAction* iconsView = new KToggleAction(i18n("Icons"), actionCollection(), "icons");
iconsView->setShortcut(Qt::CTRL | Qt::Key_1);
iconsView->setIcon(KIcon("view_icon"));
connect(iconsView, SIGNAL(triggered()), this, SLOT(setIconsView()));
- //KRadioAction* detailsView = new KRadioAction(i18n("Details"), "Ctrl+2",
- // this, SLOT(setDetailsView()),
- // actionCollection(), "details");
- KAction* detailsView = new KAction(i18n("Details"), actionCollection(), "details");
+ KToggleAction* detailsView = new KToggleAction(i18n("Details"), actionCollection(), "details");
detailsView->setShortcut(Qt::CTRL | Qt::Key_2);
detailsView->setIcon(KIcon("view_text"));
connect(detailsView, SIGNAL(triggered()), this, SLOT(setIconsView()));
- //KRadioAction* previewsView = new KRadioAction(i18n("Previews"), "Ctrl+3",
- // this, SLOT(setPreviewsView()),
- // actionCollection(), "previews");
- KAction* previewsView = new KAction(i18n("Previews"), actionCollection(), "previews");
+ KToggleAction* previewsView = new KToggleAction(i18n("Previews"), actionCollection(), "previews");
previewsView->setShortcut(Qt::CTRL | Qt::Key_3);
previewsView->setIcon(KIcon("gvdirpart"));
connect(previewsView, SIGNAL(triggered()), this, SLOT(setPreviewsView()));
viewModeGroup->addAction(detailsView);
viewModeGroup->addAction(previewsView);
- KAction* sortByName = new KAction(i18n("By Name"), actionCollection(), "by_name");
+ KToggleAction* sortByName = new KToggleAction(i18n("By Name"), actionCollection(), "by_name");
connect(sortByName, SIGNAL(triggered()), this, SLOT(sortByName()));
- KAction* sortBySize = new KAction(i18n("By Size"), actionCollection(), "by_name");
+ KToggleAction* sortBySize = new KToggleAction(i18n("By Size"), actionCollection(), "by_size");
connect(sortBySize, SIGNAL(triggered()), this, SLOT(sortBySize()));
- KAction* sortByDate = new KAction(i18n("By Date"), actionCollection(), "by_name");
+ KToggleAction* sortByDate = new KToggleAction(i18n("By Date"), actionCollection(), "by_date");
connect(sortByDate, SIGNAL(triggered()), this, SLOT(sortByDate()));
QActionGroup* sortGroup = new QActionGroup(this);
const QString name(config.readEntry("Name"));
QString key(name);
- const QString path(config.readPathEntry("URL"));
+ const QString path(config.readPathEntry("Url"));
if (!path.endsWith("emptydir")) {
if (path.endsWith("TextFile.txt")) {
key = "1" + key;
else if (!KDesktopFile::isDesktopFile(path)) {
key = "2" + key;
}
- else if (path.endsWith("URL.desktop")){
+ else if (path.endsWith("Url.desktop")){
key = "3" + key;
}
else if (path.endsWith("Program.desktop")){
void Dolphin::updateHistory()
{
int index = 0;
- const Q3ValueList<URLNavigator::HistoryElem> list = m_activeView->urlHistory(index);
+ const Q3ValueList<UrlNavigator::HistoryElem> list = m_activeView->urlHistory(index);
KAction* backAction = actionCollection()->action("go_back");
if (backAction != 0) {
void Dolphin::updateGoActions()
{
KAction* goUpAction = actionCollection()->action(KStdAction::stdName(KStdAction::Up));
- const KUrl& currentURL = m_activeView->url();
- goUpAction->setEnabled(currentURL.upUrl() != currentURL);
+ const KUrl& currentUrl = m_activeView->url();
+ goUpAction->setEnabled(currentUrl.upUrl() != currentUrl);
}
void Dolphin::updateViewProperties(const KUrl::List& urls)
}
// Updating the view properties might take up to several seconds
- // when dragging several thousand URLs. Writing a KIO slave for this
+ // when dragging several thousand Urls. Writing a KIO slave for this
// use case is not worth the effort, but at least the main widget
// must be disabled and a progress should be shown.
ProgressIndicator progressIndicator(i18n("Updating view properties..."),
}
}
-void Dolphin::copyURLs(const KUrl::List& source, const KUrl& dest)
+void Dolphin::copyUrls(const KUrl::List& source, const KUrl& dest)
{
KIO::Job* job = KIO::copy(source, dest);
addPendingUndoJob(job, DolphinCommand::Copy, source, dest);
}
-void Dolphin::moveURLs(const KUrl::List& source, const KUrl& dest)
+void Dolphin::moveUrls(const KUrl::List& source, const KUrl& dest)
{
KIO::Job* job = KIO::move(source, dest);
addPendingUndoJob(job, DolphinCommand::Move, source, dest);
m_sidebar->show();
connect(m_sidebar, SIGNAL(urlChanged(const KUrl&)),
- this, SLOT(slotURLChangeRequest(const KUrl&)));
+ this, SLOT(slotUrlChangeRequest(const KUrl&)));
m_splitter->setCollapsible(m_sidebar, false);
m_splitter->setResizeMode(m_sidebar, QSplitter::KeepSize);
m_splitter->moveToFirst(m_sidebar);