summaryrefslogtreecommitdiffstats
path: root/tdefilereplace
diff options
context:
space:
mode:
Diffstat (limited to 'tdefilereplace')
-rw-r--r--tdefilereplace/tdefilereplacepart.cpp13
-rw-r--r--tdefilereplace/tdefilereplacepartui.rc6
-rw-r--r--tdefilereplace/tdefilereplaceview.cpp87
-rw-r--r--tdefilereplace/tdefilereplaceview.h4
4 files changed, 75 insertions, 35 deletions
diff --git a/tdefilereplace/tdefilereplacepart.cpp b/tdefilereplace/tdefilereplacepart.cpp
index 455b69c..7d0da75 100644
--- a/tdefilereplace/tdefilereplacepart.cpp
+++ b/tdefilereplace/tdefilereplacepart.cpp
@@ -501,9 +501,13 @@ void TDEFileReplacePart::resetActions()
// Results
actionCollection()->action("results_infos")->setEnabled(hasItems);
actionCollection()->action("results_openfile")->setEnabled(hasItems);
+ actionCollection()->action("results_openfilewith")->setEnabled(hasItems);
if (actionCollection()->action("results_editfile"))
+ {
actionCollection()->action("results_editfile")->setEnabled(hasItems);
+ }
actionCollection()->action("results_opendir")->setEnabled(hasItems);
+ actionCollection()->action("results_removeentry")->setEnabled(hasItems);
actionCollection()->action("results_delete")->setEnabled(hasItems);
actionCollection()->action("results_treeexpand")->setEnabled(hasItems);
actionCollection()->action("results_treereduce")->setEnabled(hasItems);
@@ -606,13 +610,15 @@ void TDEFileReplacePart::initGUI()
// Results
(void)new TDEAction(i18n("&Properties"), "informations", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultProperties()), actionCollection(), "results_infos");
- (void)new TDEAction(i18n("&Open"), "document-new", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultOpen()), actionCollection(), "results_openfile");
+ (void)new TDEAction(i18n("&Open"), "document-open", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultOpen()), actionCollection(), "results_openfile");
+ (void)new TDEAction(i18n("Open &With..."), "document-open", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultOpen()), actionCollection(), "results_openfilewith");
if(quantaFound)
{
(void)new TDEAction(i18n("&Edit in Quanta"), "quanta", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultEdit()), actionCollection(), "results_editfile");
}
- (void)new TDEAction(i18n("Open Parent &Folder"), "document-open", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultDirOpen()), actionCollection(), "results_opendir");
+ (void)new TDEAction(i18n("Open Parent &Folder"), "go-up", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultDirOpen()), actionCollection(), "results_opendir");
+ (void)new TDEAction(i18n("Remove &Entry"), "edit-clear", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultRemoveEntry()), actionCollection(), "results_removeentry");
(void)new TDEAction(i18n("&Delete"), "edit-delete", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultDelete()), actionCollection(), "results_delete");
(void)new TDEAction(i18n("E&xpand Tree"), 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultTreeExpand()), actionCollection(), "results_treeexpand");
(void)new TDEAction(i18n("&Reduce Tree"), 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultTreeReduce()), actionCollection(), "results_treereduce");
@@ -659,8 +665,11 @@ void TDEFileReplacePart::freezeActions()
actionCollection()->action("results_infos")->setEnabled(false);
actionCollection()->action("results_openfile")->setEnabled(false);
if (actionCollection()->action("results_editfile"))
+ {
actionCollection()->action("results_editfile")->setEnabled(false);
+ }
actionCollection()->action("results_opendir")->setEnabled(false);
+ actionCollection()->action("results_removeentry")->setEnabled(false);
actionCollection()->action("results_delete")->setEnabled(false);
actionCollection()->action("results_treeexpand")->setEnabled(false);
actionCollection()->action("results_treereduce")->setEnabled(false);
diff --git a/tdefilereplace/tdefilereplacepartui.rc b/tdefilereplace/tdefilereplacepartui.rc
index e946144..7616165 100644
--- a/tdefilereplace/tdefilereplacepartui.rc
+++ b/tdefilereplace/tdefilereplacepartui.rc
@@ -1,5 +1,5 @@
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="tdefilereplace" version="6">
+<kpartgui name="tdefilereplace" version="7">
<MenuBar>
<Menu name="tdefilerepace"><text>Search/&amp;Replace</text>
<Action name="new_project"/>
@@ -23,8 +23,10 @@
</Menu>
<Menu name="results"><text>&amp;Results</text>
<Action name="results_openfile"/>
- <Action name="results_opendir"/>
+ <Action name="results_openfilewith"/>
<Action name="results_editfile"/>
+ <Action name="results_opendir"/>
+ <Action name="results_removeentry"/>
<Action name="results_delete"/>
<Action name="results_infos"/>
<Separator/>
diff --git a/tdefilereplace/tdefilereplaceview.cpp b/tdefilereplace/tdefilereplaceview.cpp
index 4bf7319..dd23ad5 100644
--- a/tdefilereplace/tdefilereplaceview.cpp
+++ b/tdefilereplace/tdefilereplaceview.cpp
@@ -74,17 +74,31 @@ TDEFileReplaceView::TDEFileReplaceView(RCOptions* info, TQWidget *parent,const c
whatsThis();
}
-TQString TDEFileReplaceView::currentPath()
+TQString TDEFileReplaceView::getItemPath(const TQListViewItem *lvi)
{
- TQListViewItem *lvi;
-
- if(! m_lviCurrent) lvi = m_rv->currentItem();
- else lvi = (TQListViewItem*) m_lviCurrent;
+ if (!lvi)
+ {
+ return TQString::null;
+ }
+ return TQString(lvi->text(1)+"/"+lvi->text(0));
+}
+TQListViewItem* TDEFileReplaceView::getCurrItemTopLevelParent()
+{
+ TQListViewItem *lvi;
+ if (!m_lviCurrent)
+ {
+ lvi = m_rv->currentItem();
+ }
+ else
+ {
+ lvi = (TQListViewItem*)m_lviCurrent;
+ }
while (lvi->parent())
+ {
lvi = lvi->parent();
-
- return TQString(lvi->text(1)+"/"+lvi->text(0));
+ }
+ return lvi;
}
void TDEFileReplaceView::showSemaphore(TQString s)
@@ -216,10 +230,10 @@ void TDEFileReplaceView::slotResultReturnPressed (TQListViewItem *lvi)
void TDEFileReplaceView::slotResultProperties()
{
- TQString currItem = currentPath();
- if(! currItem.isEmpty())
+ TQString currItemPath = getItemPath(getCurrItemTopLevelParent());
+ if (!currItemPath.isEmpty())
{
- KURL url(currItem);
+ KURL url(currItemPath);
(void) new KPropertiesDialog(url);
m_lviCurrent = 0;
}
@@ -227,21 +241,21 @@ void TDEFileReplaceView::slotResultProperties()
void TDEFileReplaceView::slotResultOpen()
{
- TQString currItem = currentPath();
- if(!currItem.isEmpty())
+ TQString currItemPath = getItemPath(getCurrItemTopLevelParent());
+ if (!currItemPath.isEmpty())
{
- (void) new KRun(KURL(currItem), 0, true, true);
+ (void) new KRun(KURL(currItemPath), 0, true, true);
m_lviCurrent = 0;
}
}
void TDEFileReplaceView::slotResultOpenWith()
{
- TQString currItem = currentPath();
- if(!currItem.isEmpty())
+ TQString currItemPath = getItemPath(getCurrItemTopLevelParent());
+ if (!currItemPath.isEmpty())
{
KURL::List kurls;
- kurls.append(KURL(currItem));
+ kurls.append(KURL(currItemPath));
KRun::displayOpenWithDialog(kurls);
m_lviCurrent = 0;
}
@@ -249,11 +263,11 @@ void TDEFileReplaceView::slotResultOpenWith()
void TDEFileReplaceView::slotResultDirOpen()
{
- TQString currItem = currentPath();
- if(!currItem.isEmpty())
+ TQString currItemPath = getItemPath(getCurrItemTopLevelParent());
+ if (!currItemPath.isEmpty())
{
TQFileInfo fi;
- fi.setFile(currItem);
+ fi.setFile(currItemPath);
(void) new KRun (KURL::fromPathOrURL(fi.dirPath()), 0, true, true);
m_lviCurrent = 0;
}
@@ -304,21 +318,32 @@ void TDEFileReplaceView::slotResultEdit()
m_lviCurrent = 0;
}
+void TDEFileReplaceView::slotResultRemoveEntry()
+{
+ TQListViewItem *currItem = getCurrItemTopLevelParent();
+ if (currItem)
+ {
+ delete currItem;
+ m_lviCurrent = 0;
+ }
+}
+
void TDEFileReplaceView::slotResultDelete()
{
- TQString currItem = currentPath();
- if (!currItem.isEmpty())
+ TQListViewItem *currItem = getCurrItemTopLevelParent();
+ TQString currItemPath = getItemPath(currItem);
+ if (currItem)
{
TQFile fi;
- int answer = KMessageBox::warningContinueCancel(this, i18n("Do you really want to delete %1?").arg(currItem),
+ int answer = KMessageBox::warningContinueCancel(this, i18n("Do you really want to delete %1?").arg(currItemPath),
TQString(),KStdGuiItem::del());
if(answer == KMessageBox::Continue)
{
- fi.setName(currItem);
+ fi.setName(currItemPath);
fi.remove();
- delete m_lviCurrent;
+ delete currItem;
m_lviCurrent = 0;
}
}
@@ -549,12 +574,10 @@ void TDEFileReplaceView::initGUI()
i18n("&Open"),
this,
TQT_SLOT(slotResultOpen()));
- if(!quantaFound)
- {
- m_menuResult->insertItem(i18n("Open &With..."),
- this,
- TQT_SLOT(slotResultOpenWith()));
- }
+ m_menuResult->insertItem(SmallIconSet(TQString::fromLatin1("document-open")),
+ i18n("Open &With..."),
+ this,
+ TQT_SLOT(slotResultOpenWith()));
if(quantaFound)
{
@@ -568,6 +591,10 @@ void TDEFileReplaceView::initGUI()
i18n("Open Parent &Folder"),
this,
TQT_SLOT(slotResultDirOpen()));
+ m_menuResult->insertItem(SmallIconSet(TQString::fromLatin1("edit-clear")),
+ i18n("Remove &Entry"),
+ this,
+ TQT_SLOT(slotResultRemoveEntry()));
m_menuResult->insertItem(SmallIconSet(TQString::fromLatin1("edit-delete")),
i18n("&Delete"),
this,
diff --git a/tdefilereplace/tdefilereplaceview.h b/tdefilereplace/tdefilereplaceview.h
index 6eae3d4..9a4721f 100644
--- a/tdefilereplace/tdefilereplaceview.h
+++ b/tdefilereplace/tdefilereplaceview.h
@@ -62,7 +62,8 @@ class TDEFileReplaceView : public TDEFileReplaceViewWdg
TDEFileReplaceView(RCOptions* info, TQWidget *parent,const char *name);
public:
- TQString currentPath();
+ TQString getItemPath(const TQListViewItem *lvi);
+ TQListViewItem* getCurrItemTopLevelParent();
void showSemaphore(TQString s);
void displayScannedFiles(int foldersNumber, int filesNumber);
void stringsInvert(bool invertAll);
@@ -83,6 +84,7 @@ class TDEFileReplaceView : public TDEFileReplaceViewWdg
void slotResultOpenWith();
void slotResultDirOpen();
void slotResultEdit();
+ void slotResultRemoveEntry();
void slotResultDelete();
void slotResultTreeExpand();
void slotResultTreeReduce();