[KimDaBa] Search dialog : remember the last date used
Jean-Michel FAYARD
jmfayard at gmail.com
Sat Dec 4 08:49:41 GMT 2004
The title says it all.
--- datefolder.cpp.20041203 2004-12-03 03:05:50.000000000 +0100
+++ datefolder.cpp 2004-12-03 09:43:34.407452760 +0100
@@ -58,6 +58,8 @@
ImageSearchInfo info( _info );
info.setStartDate( ImageDate( dialog.fromDate() ) );
info.setEndDate( ImageDate( dialog.toDate() ) );
+ Options::instance()->setFromDate( dialog.fromDate() );
+ Options::instance()->setToDate( dialog.toDate() );
return new ContentFolderAction( QString::null, QString::null,
info, _browser );
}
else
@@ -87,8 +89,10 @@
_to = new KDatePicker( top );
lay3->addWidget( _to );
- _from->setDate( QDate( QDate::currentDate().year(), 1, 1 ) );
- _to->setDate( QDate( QDate::currentDate().year()+1, 1, 1 ) );
+//JM _from->setDate( QDate( QDate::currentDate().year(), 1, 1 ) );
+//JM _to->setDate( QDate( QDate::currentDate().year()+1, 1, 1 ) );
+ _from->setDate( Options::instance()->fromDate() );
+ _to->setDate( Options::instance()->toDate() );
_prevFrom = _from->date();
_prevTo = _to ->date();
highlightPossibleDates( _from );
--- options.cpp.20041203 2004-09-23 21:44:59.000000000 +0200
+++ options.cpp 2004-12-03 09:28:50.272861648 +0100
@@ -35,6 +35,8 @@
#include <qtextstream.h>
#include <qregexp.h>
#include <qmessagebox.h>
+#include <qdatetime.h>
+#include <qnamespace.h>
Options* Options::_instance = 0;
@@ -70,6 +72,12 @@
_passwd = config.attribute( QString::fromLatin1( "passwd" ) );
_albumCategory = config.attribute( QString::fromLatin1(
"albumCategory" ) );
_viewSortType = (ViewSortType) config.attribute(
QString::fromLatin1( "viewSortType" ) ).toInt();
+ _fromDate = QDate::fromString( config.attribute(
QString::fromLatin1( "fromDate" ) ), ISODate );
+ if (! _fromDate.isValid() )
+ _fromDate = QDate( QDate::currentDate().year(), 1, 1 );
+ _toDate = QDate::fromString( config.attribute(
QString::fromLatin1( "toDate" ) ), ISODate );
+ if (! _toDate.isValid() )
+ _toDate = QDate( QDate::currentDate().year()+1, 1, 1 );
_launchViewerFullScreen = (bool) config.attribute(
QString::fromLatin1( "launchViewerFullScreen" ) ).toInt();
_launchSlideShowFullScreen = (bool) config.attribute(
QString::fromLatin1( "launchSlideShowFullScreen" ) ).toInt();
_displayLabels = (bool) config.attribute( QString::fromLatin1(
"displayLabels" ), QString::fromLatin1( "1" ) ).toInt();
@@ -167,6 +175,8 @@
config.setAttribute( QString::fromLatin1("passwd"), _passwd );
config.setAttribute( QString::fromLatin1( "albumCategory" ),
_albumCategory );
config.setAttribute( QString::fromLatin1( "viewSortTye" ), _viewSortType );
+ config.setAttribute( QString::fromLatin1( "fromDate" ),
_fromDate.toString( Qt::ISODate ) );
+ config.setAttribute( QString::fromLatin1( "toDate" ),
_toDate.toString( Qt::ISODate ) );
config.setAttribute( QString::fromLatin1( "slideShowInterval" ),
_slideShowInterval );
config.setAttribute( QString::fromLatin1(
"launchViewerFullScreen" ), _launchViewerFullScreen );
config.setAttribute( QString::fromLatin1(
"launchSlideShowFullScreen" ), _launchSlideShowFullScreen );
@@ -727,6 +737,28 @@
return _viewSortType;
}
+void Options::setFromDate( const QDate& date)
+{
+ if (date.isValid())
+ _fromDate = date;
+}
+
+QDate Options::fromDate() const
+{
+ return _fromDate;
+}
+
+void Options::setToDate( const QDate& date)
+{
+ if (date.isValid())
+ _toDate = date;
+}
+
+QDate Options::toDate() const
+{
+ return _toDate;
+}
+
void Options::setSlideShowInterval( int interval )
{
_slideShowInterval = interval;
--- options.h.20041203 2004-09-23 21:44:59.000000000 +0200
+++ options.h 2004-12-03 09:03:06.000000000 +0100
@@ -58,6 +58,11 @@
void setViewSortType( ViewSortType );
ViewSortType viewSortType() const;
+ void setFromDate( const QDate& );
+ QDate fromDate() const;
+ void setToDate( const QDate& );
+ QDate toDate() const;
+
// -------------------------------------------------- Options
void setOption( const QString& optionGroup, const QStringList& value );
void addOption( const QString& optionGroup, const QString& value );
@@ -210,6 +215,7 @@
QMap<QString, QStringList> _options;
QMap<QString,OptionGroupInfo> _optionGroups;
QString _imageDirectory, _htmlBaseDir, _htmlBaseURL, _htmlDestURL;
+ QDate _fromDate, _toDate;
Position _infoBoxPosition;
bool _showInfoBox, _showDrawings, _showDescription, _showDate, _showTime;
More information about the Kphotoalbum
mailing list