[Patch] Sort by time of modification in iconview + multicolumsnview

Leo Savernik l.savernik at aon.at
Wed Feb 12 17:20:59 GMT 2003


Am Mittwoch, 12. Februar 2003 16:00 schrieb Anna Nymos:
> This patch allows sorting the files in icon-/multicolumnview by time of
> last modification. Maybe I should make it possible to sort by time of
> creation and time of last access too (as suggested in
> http://bugs.kde.org/show_bug.cgi?id=52750 ). Do you think 3 entries to sort
> by time/date make sense? Attached are the diff files containing the needed
> changes in kdebase/konqueror/iconview/. I'm sure the diffs don't have the
> correct format but I don't know how to do it better.

Looks quite good.

However,

+                QDateTime* dayt = new QDateTime();
+                dayt->setTime_t(item->item()->time(KIO::UDS_MODIFICATION_TIME 
));

you allocate dayt but never delete it! That's severe. What you want is 
probably something like that:

	QDateTime dayt;
	dayt.setTime_t(...);

This occurs twice, please fix it in both locations. For the second appearance 
(setupSortKeys()) you should pull out the definition of dayt of the for-loop:
	
	QDateTime dayt;
	for (...) {
		dayt.setTime_t(...);
		...
	}

Then some smaller nits:

+    KToggleAction *aSortByTime = new KRadioAction( i18n( "By Time" ), 0, 
actionCollection(), "sort_time" );

maybe it'd be better if you called it "By Date" instead.

+  setupSorting( Time );
+}
 void KonqKfmIconView::setupSorting( SortCriterion criterion )

Please always insert an empty line between two methods.

If you have done the changes append them to bug 52750 as an attachment and 
send an answer to this thread containing a link to that attachment.

mfg
	Leo





More information about the kfm-devel mailing list