summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--konqueror/listview/konq_detailedlistview.rc1
-rw-r--r--konqueror/listview/konq_infolistview.rc1
-rw-r--r--konqueror/listview/konq_listview.cpp122
-rw-r--r--konqueror/listview/konq_listview.h2
-rw-r--r--konqueror/listview/konq_listviewitems.cpp8
-rw-r--r--konqueror/listview/konq_textview.rc1
-rw-r--r--konqueror/listview/konq_treeview.rc1
-rw-r--r--libkonq/konq_propsview.cpp24
-rw-r--r--libkonq/konq_propsview.h10
9 files changed, 167 insertions, 3 deletions
diff --git a/konqueror/listview/konq_detailedlistview.rc b/konqueror/listview/konq_detailedlistview.rc
index 06c9bc318..b3238e2ad 100644
--- a/konqueror/listview/konq_detailedlistview.rc
+++ b/konqueror/listview/konq_detailedlistview.rc
@@ -23,6 +23,7 @@
<Action name="modesmall"/>
</Menu>
<Separator/>
+ <Action name="change_hidden_file_matcher"/>
<Action name="show_dot"/>
<Menu name="sort"><text>&amp;Sort</text>
<Action name="order_unicode_based"/>
diff --git a/konqueror/listview/konq_infolistview.rc b/konqueror/listview/konq_infolistview.rc
index 60f511b1f..9e28d2b44 100644
--- a/konqueror/listview/konq_infolistview.rc
+++ b/konqueror/listview/konq_infolistview.rc
@@ -23,6 +23,7 @@
<Action name="modesmall"/>
</Menu>
<Separator/>
+ <Action name="change_hidden_file_matcher"/>
<Action name="show_dot"/>
<Menu name="sort"><text>&amp;Sort</text>
<Action name="order_unicode_based"/>
diff --git a/konqueror/listview/konq_listview.cpp b/konqueror/listview/konq_listview.cpp
index 5a06068ca..a2a2bef0a 100644
--- a/konqueror/listview/konq_listview.cpp
+++ b/konqueror/listview/konq_listview.cpp
@@ -477,6 +477,110 @@ void KonqListView::newIconSize( int size )
m_pListView->updateListContents();
}
+void KonqListView::slotChangeHiddenFileMatcher()
+{
+
+ /* Temporarily
+ */
+
+ TDEIO::HiddenFileMatcher* matcher = TDEIO::HiddenFileMatcher::getInstance();
+
+ // Someday we will do this and it will actually accomplish what we want:
+
+ TQString updated_criteria = matcher->updateCriteria( "Define hidden for listview" );
+ if ( matcher->setCriteria( updated_criteria ) ) {
+ m_pProps->setHiddenFileSpec ( updated_criteria );
+ }
+ else {
+ kdWarning()
+ << "Failed to update critera - bad input? <"
+ << updated_criteria << ">"
+ << endl;
+ }
+
+ // Until the UI dialog is ready, we'll just do a demonstration
+
+ TQString stored_criteria = m_pProps->hiddenFileSpec();
+ TQString stored_criteria_saved = stored_criteria;
+
+ TQString active_criteria = matcher->getCriteria();
+
+ kdWarning()
+ << "Hidden file match criteria before test updates:" << endl
+ << " Config: <" << stored_criteria << "> (assuming that this is a good match criteria)" << endl
+ << " Active: <" << active_criteria << "> (should be same because of KonqListview initialization)" << endl
+ ;
+
+ // What happens with good update?
+
+ updated_criteria = "R^good/criteria$"; // simulation of output of TBD UI dialog:
+ // TQString updated_criteria = Get_HiddenFileCriteri_Dialog(stored_criteria);
+ if ( matcher->setCriteria( updated_criteria ) ) {
+ m_pProps->setHiddenFileSpec ( updated_criteria );
+ }
+ else {
+ kdWarning()
+ << "Failed to update critera - bad input? <"
+ << updated_criteria << ">"
+ << endl;
+ }
+
+ active_criteria = matcher->getCriteria();
+ stored_criteria = m_pProps->hiddenFileSpec();
+ kdWarning()
+ << "Hidden file match criteria after test update 1:" << endl
+ << " Update: <" << updated_criteria << ">" << endl
+ << " Active: <" << active_criteria << ">" << endl
+ << " Config: <" << stored_criteria << ">" << endl
+ ;
+
+ // What happens with bad update?
+
+ updated_criteria = "^bad/need/leading/W_w_R_r";
+ if ( matcher->setCriteria( updated_criteria ) ) {
+ m_pProps->setHiddenFileSpec ( updated_criteria );
+ }
+ else {
+ kdWarning()
+ << "Failed to update critera - bad input? <"
+ << updated_criteria << ">"
+ << endl;
+ }
+
+ active_criteria = matcher->getCriteria();
+ stored_criteria = m_pProps->hiddenFileSpec();
+ kdWarning()
+ << "Hidden file match criteria after test update 2:" << endl
+ << " Update: <" << updated_criteria << ">" << endl
+ << " Active: <" << active_criteria << ">" << endl
+ << " Config: <" << stored_criteria << ">" << endl
+ ;
+
+ // Restore the original (and hopefully valid) match criteria
+
+ updated_criteria = stored_criteria_saved;
+ if ( matcher->setCriteria( updated_criteria ) ) {
+ m_pProps->setHiddenFileSpec ( updated_criteria );
+ }
+ else {
+ kdWarning()
+ << "Failed to update critera - bad input? <"
+ << updated_criteria << ">"
+ << endl;
+ }
+
+ active_criteria = matcher->getCriteria();
+ stored_criteria = m_pProps->hiddenFileSpec();
+ kdWarning()
+ << "Hidden file match criteria after restoring original criteria:" << endl
+ << " Update: <" << updated_criteria << ">" << endl
+ << " Active: <" << active_criteria << ">" << endl
+ << " Config: <" << stored_criteria << ">" << endl
+ ;
+
+ return;
+}
+
void KonqListView::slotShowDot()
{
m_pProps->setShowingDotFiles( m_paShowDot->isChecked() );
@@ -929,7 +1033,23 @@ void KonqListView::setupActions()
m_paRenameMovePrev->setToolTip( i18n("Complete rename operation and move the previous item"));
m_paRenameMovePrev->setEnabled(false);
- m_paShowDot = new TDEToggleAction( i18n( "Show &Hidden Files" ), 0, this, TQT_SLOT( slotShowDot() ), actionCollection(), "show_dot" );
+ m_paChangeHiddenFileMatcher = new TDEAction( i18n( "Change &Hidden File Matcher" ), CTRL+SHIFT+Key_H, this,
+ TQT_SLOT( slotChangeHiddenFileMatcher() ), actionCollection(), "change_hidden_file_matcher" );
+ /* Temporarily
+ */
+ // Initialize hidden file matcher criteria
+ TDEIO::HiddenFileMatcher* matcher = TDEIO::HiddenFileMatcher::getInstance();
+ // This is probably the 1st call that creates the central instance
+ matcher->setCriteria( m_pProps->hiddenFileSpec() );
+ /* Do we want or need to display current match criteria in menu???
+ Sample from konq_iconview.cpp::KonqKfmIconView::KonqKfmIconView
+ //enable menu item representing the saved sorting criterion
+ TQString sortcrit = KonqIconViewFactory::defaultViewProps()->sortCriterion();
+ TDERadioAction *sort_action = tqt_dynamic_cast<TDERadioAction *>(actionCollection()->action(sortcrit.latin1()));
+ if(sort_action!=NULL) sort_action->activate();
+ */
+
+ m_paShowDot = new TDEToggleAction( i18n( "Show &Hidden Files" ), CTRL+Key_H, this, TQT_SLOT( slotShowDot() ), actionCollection(), "show_dot" );
// m_paShowDot->setCheckedState(i18n("Hide &Hidden Files"));
m_paCaseInsensitive = new TDEToggleAction(i18n("Case Insensitive Sort"), 0, this, TQT_SLOT(slotCaseInsensitive()),actionCollection(), "sort_caseinsensitive" );
diff --git a/konqueror/listview/konq_listview.h b/konqueror/listview/konq_listview.h
index fc72f6e87..f7ba3afc9 100644
--- a/konqueror/listview/konq_listview.h
+++ b/konqueror/listview/konq_listview.h
@@ -111,6 +111,7 @@ protected slots:
void slotCaseInsensitive();
void slotSelectionChanged();
+ void slotChangeHiddenFileMatcher();
void slotShowDot();
//this is called if a item in the submenu is toggled
//it saves the new configuration according to the menu items
@@ -188,6 +189,7 @@ private:
TDEToggleAction *m_paCaseInsensitive;
+ TDEAction *m_paChangeHiddenFileMatcher;
TDEToggleAction *m_paShowDot;
TDEToggleAction *m_paShowTime;
TDEToggleAction *m_paShowType;
diff --git a/konqueror/listview/konq_listviewitems.cpp b/konqueror/listview/konq_listviewitems.cpp
index 5eac5420b..c539a4c5d 100644
--- a/konqueror/listview/konq_listviewitems.cpp
+++ b/konqueror/listview/konq_listviewitems.cpp
@@ -88,14 +88,18 @@ void KonqListViewItem::updateContents()
bool m_groupDirectoriesFirst = m_pListViewWidget->props()->isDirsFirst();
bool m_groupHiddenFirst = m_pListViewWidget->props()->isHiddenFirst();
- // The default TDE order is: .dir (0), dir (1), .file (2), file (3)
+ // The default TDE display order is:
+ // hidden-dir (0), non-hidden-dir (1), hidden-file (2), non-hidden-file (3)
if ( m_groupDirectoriesFirst )
sortChar = S_ISDIR( m_fileitem->mode() ) ? 1 : 3;
else
sortChar = 3;
- if ( m_groupHiddenFirst && TDEIO::fileIsHidden(m_fileitem->text()) )
+ /* Temporarily
+ */
+ TDEIO::HiddenFileMatcher* matcher = TDEIO::HiddenFileMatcher::getInstance();
+ if ( m_groupHiddenFirst && matcher->match(m_fileitem->text()) )
--sortChar;
//now we have the first column, so let's do the rest
diff --git a/konqueror/listview/konq_textview.rc b/konqueror/listview/konq_textview.rc
index e29a0293b..37cbaa67c 100644
--- a/konqueror/listview/konq_textview.rc
+++ b/konqueror/listview/konq_textview.rc
@@ -12,6 +12,7 @@
</Menu>
</Menu>
<Menu name="view"><text>&amp;View</text>
+ <Action name="change_hidden_file_matcher"/>
<Action name="show_dot" />
<Menu name="sort"><text>&amp;Sort</text>
<Action name="order_unicode_based"/>
diff --git a/konqueror/listview/konq_treeview.rc b/konqueror/listview/konq_treeview.rc
index 9ef045785..9a603ee02 100644
--- a/konqueror/listview/konq_treeview.rc
+++ b/konqueror/listview/konq_treeview.rc
@@ -23,6 +23,7 @@
<Action name="modesmall"/>
</Menu>
<Separator/>
+ <Action name="change_hidden_file_matcher"/>
<Action name="show_dot"/>
<Menu name="sort"><text>&amp;Sort</text>
<Action name="order_unicode_based"/>
diff --git a/libkonq/konq_propsview.cpp b/libkonq/konq_propsview.cpp
index f72aee191..61e454a40 100644
--- a/libkonq/konq_propsview.cpp
+++ b/libkonq/konq_propsview.cpp
@@ -74,6 +74,7 @@ struct KonqPropsView::Private
bool hiddenfirst:1;
bool descending:1;
TQString sortcriterion;
+ TQString hiddenfilecriteria;
};
KonqPropsView::KonqPropsView( TDEInstance * instance, KonqPropsView * defaultProps )
@@ -98,6 +99,7 @@ KonqPropsView::KonqPropsView( TDEInstance * instance, KonqPropsView * defaultPro
d->dirsfirst = config->readBoolEntry( "SortDirsFirst", true );
d->hiddenfirst = config->readBoolEntry( "SortHiddenFirst", true );
d->descending = config->readBoolEntry( "SortDescending", false );
+ d->hiddenfilecriteria = config->readEntry( "HiddenFileSpec", "w.*" ); // default is wildcard for dotfiles
m_bShowDot = config->readBoolEntry( "ShowDotFiles", false );
m_bShowDirectoryOverlays = config->readBoolEntry( "ShowDirectoryOverlays", false );
m_bShowFreeSpaceOverlays = config->readBoolEntry( "ShowFreeSpaceOverlays", true );
@@ -164,6 +166,11 @@ bool KonqPropsView::isDescending() const
return d->descending;
}
+const TQString& KonqPropsView::hiddenFileSpec() const
+{
+ return d->hiddenfilecriteria;
+}
+
TDEConfigBase * KonqPropsView::currentConfig()
{
if ( !m_currentConfig )
@@ -388,6 +395,23 @@ void KonqPropsView::setDescending( bool descend)
}
}
+void KonqPropsView::setHiddenFileSpec( const TQString &criteria )
+{
+ kdDebug(1203) << "KonqPropsView::setHiddenFileSpec " << criteria << endl;
+ d->hiddenfilecriteria = criteria;
+ if ( m_defaultProps && !m_bSaveViewPropertiesLocally ) {
+ kdDebug(1203) << "Saving in default properties" << endl;
+ m_defaultProps->setHiddenFileSpec( criteria );
+ }
+ else if (currentConfig())
+ {
+ kdDebug(1203) << "Saving in current config" << endl;
+ TDEConfigGroupSaver cgs(currentConfig(), currentGroup());
+ currentConfig()->writeEntry( "HiddenFileSpec", d->hiddenfilecriteria );
+ currentConfig()->sync();
+ }
+}
+
void KonqPropsView::setShowingDotFiles( bool show )
{
kdDebug(1203) << "KonqPropsView::setShowingDotFiles " << show << endl;
diff --git a/libkonq/konq_propsview.h b/libkonq/konq_propsview.h
index 132c53a55..ae699f09a 100644
--- a/libkonq/konq_propsview.h
+++ b/libkonq/konq_propsview.h
@@ -104,6 +104,9 @@ public:
void setDescending (bool descending);
bool isDescending() const;
+ void setHiddenFileSpec( const TQString &criteria );
+ const TQString& hiddenFileSpec() const;
+
void setShowingDotFiles( bool show );
bool isShowingDotFiles() const { return m_bShowDot; }
@@ -188,6 +191,13 @@ private:
Private *d;
+ /**
+ * FIXME
+ *
+ * Why are some private class properties declared in the
+ * "Private" structure d in konq_propsview.cpp and not above?
+ */
+
private:
KonqPropsView( const KonqPropsView & );
KonqPropsView();