[Kde-imaging] [Bug 144185] Adjust date-time tool should remember previous fixed date
Gilles Caulier
caulier.gilles at gmail.com
Sat Jun 9 11:06:36 CEST 2007
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=144185
caulier.gilles gmail com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From caulier.gilles gmail com 2007-06-09 11:06 -------
SVN commit 673178 by cgilles:
kipi-plugins from KDE3 branch : TimeAdjust : remember the custom date set by user between session. Add button to reset custom date to current date.
BUG: 144185
M +34 -9 timeadjustdialog.cpp
M +6 -6 timeadjustdialog.h
--- branches/extragear/kde3/libs/kipi-plugins/timeadjust/timeadjustdialog.cpp #673177:673178
@ -30,6 +30,7 @
// Qt includes.
+#include <qtooltip.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qvbuttongroup.h>
@ -43,9 +44,11 @
#include <qgrid.h>
#include <qpushbutton.h>
#include <qframe.h>
+#include <qtoolbutton.h>
// KDE includes.
+#include <kiconloader.h>
#include <kdebug.h>
#include <klocale.h>
#include <kapplication.h>
@ -104,6 +107,7 @
dateCreatedSel = 0;
interface = 0;
about = 0;
+ todayBtn = 0;
}
QRadioButton *add;
@ -111,6 +115,8 @
QRadioButton *exif;
QRadioButton *custom;
+ QToolButton *todayBtn;
+
QCheckBox *syncEXIFDateCheck;
QCheckBox *syncIPTCDateCheck;
@ -195,22 +201,26 @
// -- Adjustment type ------------------------------------------------------------
QVGroupBox *adjGB = new QVGroupBox(i18n("Adjustment Type"), plainPage());
- d->adjustTypeGrp = new QButtonGroup(1, Qt::Horizontal, adjGB);
- d->add = new QRadioButton(i18n("Add"), d->adjustTypeGrp);
- d->subtract = new QRadioButton(i18n("Subtract"), d->adjustTypeGrp);
- d->exif = new QRadioButton(i18n("Set file date to EXIF/IPTC creation date"), d->adjustTypeGrp);
- d->custom = new QRadioButton(i18n("Custom date"), d->adjustTypeGrp);
+ d->adjustTypeGrp = new QButtonGroup(1, Qt::Horizontal, adjGB);
+ d->add = new QRadioButton(i18n("Add"), d->adjustTypeGrp);
+ d->subtract = new QRadioButton(i18n("Subtract"), d->adjustTypeGrp);
+ d->exif = new QRadioButton(i18n("Set file date to EXIF/IPTC creation date"), d->adjustTypeGrp);
+ d->custom = new QRadioButton(i18n("Custom date"), d->adjustTypeGrp);
d->adjustTypeGrp->setFrameStyle(QFrame::NoFrame);
d->adjustTypeGrp->setInsideMargin(0);
d->adjustTypeGrp->setRadioButtonExclusive(true);
QHBox *hbox = new QHBox(d->adjustTypeGrp);
- QLabel *space = new QLabel(hbox);
+ QLabel *space1 = new QLabel(hbox);
+ space1->setFixedWidth(15);
d->dateCreatedSel = new KDateTimeWidget(hbox);
+ QLabel *space2 = new QLabel(hbox);
+ space2->setFixedWidth(15);
+ d->todayBtn = new QToolButton(hbox);
+ d->todayBtn->setIconSet(SmallIcon("today"));
+ QToolTip::add(d->todayBtn, i18n("Reset to current date"));
new QLabel(hbox);
- space->setFixedWidth(15);
- d->dateCreatedSel->setDateTime(QDateTime::currentDateTime());
d->syncEXIFDateCheck = new QCheckBox(i18n("Update Exif creation date"), d->adjustTypeGrp);
d->syncIPTCDateCheck = new QCheckBox(i18n("Update IPTC creation date"), d->adjustTypeGrp);
@ -291,6 +301,9 @
connect(d->years, SIGNAL( valueChanged( int ) ),
this, SLOT( slotUpdateExample() ));
+ connect(d->todayBtn, SIGNAL(clicked()),
+ this, SLOT(slotResetDateToCurrent()));
+
// -----------------------------------------------------------------------
readSettings();
@ -308,6 +321,11 @
KApplication::kApplication()->invokeHelp("timeadjust", "kipi-plugins");
}
+void TimeAdjustDialog::slotResetDateToCurrent()
+{
+ d->dateCreatedSel->setDateTime(QDateTime::currentDateTime());
+}
+
void TimeAdjustDialog::closeEvent(QCloseEvent *e)
{
if (!e) return;
@ -332,6 +350,9 @
if (adjType == 2) d->exif->setChecked(true);
if (adjType == 3) d->custom->setChecked(true);
+ QDateTime current = QDateTime::currentDateTime();
+ d->dateCreatedSel->setDateTime(config.readDateTimeEntry("Custom Date", ¤t));
+
d->syncEXIFDateCheck->setChecked(config.readBoolEntry("Sync EXIF Date", true));
d->syncIPTCDateCheck->setChecked(config.readBoolEntry("Sync IPTC Date", true));
resize(configDialogSize(config, QString("Time Adjust Dialog")));
@ -348,6 +369,8 @
if (d->custom->isChecked()) adjType = 3;
config.writeEntry("Adjustment Type", adjType);
+ config.writeEntry("Custom Date", d->dateCreatedSel->dateTime());
+
config.writeEntry("Sync EXIF Date", d->syncEXIFDateCheck->isChecked());
config.writeEntry("Sync IPTC Date", d->syncIPTCDateCheck->isChecked());
saveDialogSize(config, QString("Time Adjust Dialog"));
@ -402,7 +425,7 @
QString newDate = date.toString(Qt::LocalDate);
d->exampleAdj->setText(i18n("<b>%1</b><br>would, for example, "
"change into<br><b>%2</b>")
- .arg(oldDate).arg(newDate));
+ .arg(oldDate).arg(newDate));
}
void TimeAdjustDialog::slotAdjustmentTypeChanged()
@ -410,6 +433,7 @
d->exampleBox->setEnabled(false);
d->adjustValGrp->setEnabled(false);
d->dateCreatedSel->setEnabled(false);
+ d->todayBtn->setEnabled(false);
d->syncEXIFDateCheck->setEnabled(false);
d->syncIPTCDateCheck->setEnabled(false);
@ -423,6 +447,7 @
else if (d->custom->isChecked())
{
d->dateCreatedSel->setEnabled(true);
+ d->todayBtn->setEnabled(true);
d->syncEXIFDateCheck->setEnabled(true);
d->syncIPTCDateCheck->setEnabled(true);
}
--- branches/extragear/kde3/libs/kipi-plugins/timeadjust/timeadjustdialog.h #673177:673178
@ -54,18 +54,19 @
void setImages(const KURL::List& images);
-protected slots:
+protected:
+ void closeEvent(QCloseEvent *);
+
+private slots:
+
void slotUpdateExample();
void slotAdjustmentTypeChanged();
void slotOk();
void slotCancel();
void slotHelp();
+ void slotResetDateToCurrent();
-protected:
-
- void closeEvent(QCloseEvent *);
-
private:
void readSettings();
@ -75,7 +76,6 @
private:
TimeAdjustDialogPrivate *d;
-
};
} // NameSpace KIPITimeAdjustPlugin
More information about the Kde-imaging
mailing list