Bug 128817 - configure timestamp naming format for directory names
Summary: configure timestamp naming format for directory names
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Import-Settings (show other bugs)
Version: 0.8.1
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-08 12:31 UTC by greatbunzinni
Modified: 2017-08-17 06:48 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 0.9.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description greatbunzinni 2006-06-08 12:31:11 UTC
Version:           0.8.1 (using KDE KDE 3.5.2)

When a user creates a directory from the "download from camera" dialog, the directory name has, as the prefix, the current timestamp. So if I created today a directory from that dialog, it's pre-defined name would be something like "2006, May, 08". 

Unfortunately that timestamp format isn't configurable. Personally I prefer something like "2006-06-08", which enables the directories to be automatically sorted by date when listing the parent directory's contents. Others may prefer some other format, like YYYY-MM.

So, it would be nice if the timestamp format in the pre-defined naming format would be tweakable. For example, it would be great if something similar to the solution to # 106928 would be implemented to the directories' names.
Comment 1 caulier.gilles 2006-08-24 15:30:31 UTC
*** Bug 112034 has been marked as a duplicate of this bug. ***
Comment 2 caulier.gilles 2006-08-24 17:28:55 UTC
SVN commit 576672 by cgilles:

digikam from trunk : camera gui improvements : new option to set configurable date format for auto album creation.

BUG: 119075, 128817

 M  +68 -13    cameraui.cpp  


--- trunk/extragear/graphics/digikam/utilities/cameragui/cameraui.cpp #576671:576672
@@ -110,6 +110,13 @@
 {
 public:
 
+    enum DateFormatOptions
+    {
+        IsoDateFormat=0,
+        TextDateFormat,
+        LocalDateFormat
+    };
+
     CameraUIPriv()
     {
         busy              = false;
@@ -137,6 +144,8 @@
         losslessFormat    = 0;
         convertJpegCheck  = 0;
         formatLabel       = 0;
+        folderDateLabel   = 0;
+        folderDateFormat  = 0;
     }
 
     bool                          busy;
@@ -162,8 +171,10 @@
     QCheckBox                    *convertJpegCheck;
 
     QLabel                       *formatLabel;
+    QLabel                       *folderDateLabel;
 
     QComboBox                    *losslessFormat;
+    QComboBox                    *folderDateFormat;
 
     QSplitter                    *splitter;
 
@@ -233,9 +244,19 @@
     d->renameCustomizer  = new RenameCustomizer(d->advBox);
     d->view->setRenameCustomizer(d->renameCustomizer);
         
+    // -- Albums Auto-creation options -----------------------------------------
+
     QVGroupBox* albumBox = new QVGroupBox(i18n("Auto-creation of Albums"), d->advBox);
     d->autoAlbumCheck    = new QCheckBox(i18n("Date-based sub-albums"), albumBox);
+    QHBox *hbox1         = new QHBox(albumBox);
+    d->folderDateLabel   = new QLabel(i18n("Date format:"), hbox1);
+    d->folderDateFormat  = new QComboBox(hbox1);
+    d->folderDateFormat->insertItem(i18n("ISO"),             CameraUIPriv::IsoDateFormat);
+    d->folderDateFormat->insertItem(i18n("Full Text"),       CameraUIPriv::TextDateFormat);
+    d->folderDateFormat->insertItem(i18n("Local Settings"),  CameraUIPriv::LocalDateFormat);
 
+    // -- On the Fly options ---------------------------------------------------
+
     QVGroupBox* onFlyBox = new QVGroupBox(i18n("On the Fly Operations (JPEG only)"), d->advBox);
     d->setPhotographerId = new QCheckBox(i18n("Set default photographer identity"), onFlyBox);
     d->setCredits        = new QCheckBox(i18n("Set default credit and copyright"), onFlyBox);
@@ -243,9 +264,9 @@
     d->dateTimeEdit      = new KDateTimeEdit(onFlyBox, "datepicker");
     d->autoRotateCheck   = new QCheckBox(i18n("Auto-rotate/flip image"), onFlyBox);
     d->convertJpegCheck  = new QCheckBox(i18n("Convert to lossless file format"), onFlyBox);
-    QHBox *hbox          = new QHBox(onFlyBox);
-    d->formatLabel       = new QLabel(i18n("New image format:"), hbox);
-    d->losslessFormat    = new QComboBox(hbox);
+    QHBox *hbox2         = new QHBox(onFlyBox);
+    d->formatLabel       = new QLabel(i18n("New image format:"), hbox2);
+    d->losslessFormat    = new QComboBox(hbox2);
     d->losslessFormat->insertItem("PNG", 0);
     
     QWhatsThis::add( d->autoRotateCheck, i18n("<p>Toogle on this option if you want automatically "
@@ -362,6 +383,12 @@
 
     // -------------------------------------------------------------------------
     
+    connect(d->autoAlbumCheck, SIGNAL(toggled(bool)),
+            d->folderDateFormat, SLOT(setEnabled(bool)));
+
+    connect(d->autoAlbumCheck, SIGNAL(toggled(bool)),
+            d->folderDateLabel, SLOT(setEnabled(bool)));
+
     connect(d->convertJpegCheck, SIGNAL(toggled(bool)),
             d->losslessFormat, SLOT(setEnabled(bool)));
 
@@ -492,6 +519,7 @@
     d->setCredits->setChecked(config->readBoolEntry("SetCredits", false));
     d->convertJpegCheck->setChecked(config->readBoolEntry("ConvertJpeg", false));
     d->losslessFormat->setCurrentItem(config->readNumEntry("LossLessFormat", 0));   // PNG by default
+    d->folderDateFormat->setCurrentItem(config->readNumEntry("FolderDateFormat", CameraUIPriv::IsoDateFormat));
 
     d->view->setThumbnailSize(ThumbnailSize((ThumbnailSize::Size)config->readNumEntry("ThumbnailSize", 
                               ThumbnailSize::Large)));
@@ -502,6 +530,9 @@
     d->dateTimeEdit->setEnabled(d->fixDateTimeCheck->isChecked());
     d->losslessFormat->setEnabled(convertLosslessJpegFiles());
     d->formatLabel->setEnabled(convertLosslessJpegFiles());
+    d->folderDateFormat->setEnabled(d->autoAlbumCheck->isChecked());
+    d->folderDateLabel->setEnabled(d->autoAlbumCheck->isChecked());
+
     resize(configDialogSize("Camera Settings"));
 }
 
@@ -520,6 +551,7 @@
     config->writeEntry("LossLessFormat", d->losslessFormat->currentItem());
     config->writeEntry("ThumbnailSize", d->view->thumbnailSize().size());
     config->writeEntry("Splitter Sizes", d->splitter->sizes());
+    config->writeEntry("FolderDateFormat", d->folderDateFormat->currentItem());
     config->sync();
 }
 
@@ -964,12 +996,21 @@
     {
         CameraIconViewItem* iconItem = static_cast<CameraIconViewItem*>(firstItem);
         
-        QDateTime date;
-        date.setTime_t(iconItem->itemInfo()->mtime);
-        newDirName = QString("%1, %2, %3")
-                     .arg(KGlobal::locale()->calendar()->year(date.date()))
-                     .arg(KGlobal::locale()->calendar()->monthName(date.date()))
-                     .arg(KGlobal::locale()->calendar()->day(date.date()));
+        QDateTime dateTime;
+        dateTime.setTime_t(iconItem->itemInfo()->mtime);
+
+        switch(d->folderDateFormat->currentItem())
+        {
+            case CameraUIPriv::TextDateFormat:
+                newDirName = dateTime.date().toString(Qt::TextDate);
+                break;
+            case CameraUIPriv::LocalDateFormat:
+                newDirName = dateTime.date().toString(Qt::LocalDate);
+                break;
+            default:        // IsoDateFormat
+                newDirName = dateTime.date().toString(Qt::ISODate);
+                break;
+        }
     }
 
     album = AlbumSelectDialog::selectAlbum(this, (PAlbum*)album, header, newDirName,
@@ -1026,11 +1067,25 @@
         
         if (d->autoAlbumCheck->isChecked())
         {
-            QDateTime date;
-            date.setTime_t(mtime);
-            QString dirName(date.toString("yyyy-MM-dd"));
+            QDateTime dateTime;
+            dateTime.setTime_t(mtime);
+            QString dirName;;
+
+            switch(d->folderDateFormat->currentItem())
+            {
+                case CameraUIPriv::TextDateFormat:
+                    dirName = dateTime.date().toString(Qt::TextDate);
+                    break;
+                case CameraUIPriv::LocalDateFormat:
+                    dirName = dateTime.date().toString(Qt::LocalDate);
+                    break;
+                default:        // IsoDateFormat
+                    dirName = dateTime.date().toString(Qt::ISODate);
+                    break;
+            }
+
             QString errMsg;
-            if (!createAutoAlbum(url, dirName, date.date(), errMsg))
+            if (!createAutoAlbum(url, dirName, dateTime.date(), errMsg))
             {
                 KMessageBox::error(this, errMsg);
                 return;