]> gitweb.hamatoma.de Git - reqt/commitdiff
ReComboBox, store/restore
authorhama <hama@siduction.net>
Wed, 1 Jun 2016 22:16:23 +0000 (00:16 +0200)
committerhama <hama@siduction.net>
Wed, 1 Jun 2016 22:23:59 +0000 (00:23 +0200)
* new ReComboBox: History in list, signal if edit finished
* storage of comboboxes in file

12 files changed:
appl/rebackgui/BackupUtils.cpp
appl/rebackgui/mainwindow.cpp
appl/rebackgui/mainwindow.hpp
appl/rebackgui/mainwindow.ui
appl/rebackgui/rebackgui.de.qm
appl/rebackgui/rebackgui.de.ts
appl/rebackgui/rebackgui.pro
base/ReFileUtils.cpp
base/rebase.hpp
gui/ReComboBox.cpp [new file with mode: 0644]
gui/ReComboBox.hpp [new file with mode: 0644]
gui/regui.hpp

index ed7a9d8e3d015630bceea3c007fb2ab16bd88afe..41e5d1391184c7dc4b1bd6dfd9164863f0417378 100644 (file)
@@ -43,6 +43,7 @@ QString BackupUtils::findAbstractTarget(const QString& path, ReLogger* logger)
 {
        QString rc;
 #if defined __linux__
+       (void) logger;
        QStringList args;
        ReMountInfo& mountInfo = ReMountInfo::instance(true);
        QString device = mountInfo.findDevice(path);
index 8960a11d7f9722987d0093651949fc2fbefaafef..1f41ef44d7a32757c65306c52ea1d5617c5d1e03 100644 (file)
@@ -16,7 +16,7 @@
 #include "base/retrace.hpp"
 DECLARE_TRACER(s_traceMain, "/tmp/bup_main.log");
 
-const QString VERSION("2016.05.17");
+const QString VERSION("2016.06.01");
 
 /**
  * Constructor.
@@ -202,7 +202,10 @@ void MainWindow::onGuiTimerUpdate()
  */
 void MainWindow::initializeGui(){
        ui->setupUi(this);
+       ui->comboBoxDirPatterns->setHistorySize(20);
+       ui->comboBoxFilePatterns->setHistorySize(20);
        initializeGuiElements();
+       restoreState();
        m_guiIsInitialized = false;
        initializeGuiLanguage(ui->actionEnglish, ui->actionGerman);
        startStop(false);
@@ -248,10 +251,15 @@ void MainWindow::initializeGui(){
        connect(ui->actionEnglish, SIGNAL(triggered()), this, SLOT(onEnglish()));
        connect(ui->actionGerman, SIGNAL(triggered()), this, SLOT(onGerman()));
        connect(ui->lineEditName, SIGNAL(editingFinished()), this, SLOT(onUpdateConfig()));
-       connect(ui->comboBoxDirPatterns, SIGNAL(editTextChanged(const QString&)), this, SLOT(onDirPatternTextChanged(const QString&)));
-       connect(ui->comboBoxFilePatterns, SIGNAL(editTextChanged(const QString&)), this, SLOT(onFilePatternTextChanged(const QString&)));
+       connect(ui->lineEditTarget, SIGNAL(editingFinished()), this, SLOT(onUpdateConfig()));
+       //connect(ui->comboBoxDirPatterns, SIGNAL(editTextChanged(const QString&)), this, SLOT(onDirPatternTextChanged(const QString&)));
+       //connect(ui->comboBoxFilePatterns, SIGNAL(editTextChanged(const QString&)), this, SLOT(onFilePatternTextChanged(const QString&)));
        connect(ui->tabWidget, SIGNAL(currentChanged(int)), this,
                        SLOT(onCurrentTabChanged(int)));
+       connect(ui->comboBoxDirPatterns, SIGNAL(comboTextEdited(const QString&, const QString&)),
+                       this, SLOT(onComboTextEdited(const QString&, const QString&)));
+       connect(ui->comboBoxFilePatterns, SIGNAL(comboTextEdited(const QString&, const QString&)),
+                       this, SLOT(onComboTextEdited(const QString&, const QString&)));
        m_configuration.load("");
        ui->tableWidgetConfiguration->selectRow(0);
        updateTable();
@@ -260,7 +268,6 @@ void MainWindow::initializeGui(){
                ui->actionEnglish->setChecked(true);
        else
                ui->actionGerman->setChecked(true);
-       m_guiIsInitialized = true;
        // Active Name Target Last Sources
        ui->tableWidget->setColumnWidth(0, 50);
        ui->tableWidget->setColumnWidth(1, 125);
@@ -271,6 +278,7 @@ void MainWindow::initializeGui(){
        ui->tableWidgetConfiguration->setColumnWidth(1, 175);
        ui->tableWidgetConfiguration->setColumnWidth(2, 160);
        ui->tableWidgetConfiguration->selectRow(0);
+       m_guiIsInitialized = true;
 }
 
 /**
@@ -492,6 +500,17 @@ void MainWindow::onClearFileList()
        ui->listWidgetFile->clear();
 }
 
+/**
+ * Updates the table because the combobox text has changed.
+ * @param oldText      the text before the focus has come
+ * @param newText      the current text of the combobox
+ */
+void MainWindow::onComboTextEdited(const QString& oldText, const QString& newText){
+       (void) oldText;
+       (void) newText;
+       onUpdateConfig();
+}
+
 /**
  * The current row has been changed.
  *
@@ -938,7 +957,6 @@ void MainWindow::updateTableRow(int row, BackupItem& item, QTableWidget* target)
        }
 }
 
-
 /**
  * Write the current settings into the configuration file of the target.
  *
index f6a2fffb595522b3c16ae716ee1cb27db329a462..ffc2893eed49edfecf8d4a10ea58c6ba6b02b464 100644 (file)
@@ -62,6 +62,7 @@ private slots:
    void onClearFileList();
    void onClearErrorList();
    void onClearLog();
+   void onComboTextEdited(const QString& oldText, const QString& newText);
    void onCurrentChanged(const QModelIndex& current, const QModelIndex& previous);
    void onCurrentTabChanged(int index);
    void onDeleteItem();
index 6c4bdf108fb3ea0812a4c11d54e8a4034d62c40f..5bbe0794c061f8efb00a0b7423c81467ed47b319 100644 (file)
                </widget>
               </item>
               <item>
-               <widget class="QComboBox" name="comboBoxFilePatterns">
+               <widget class="ReComboBox" name="comboBoxFilePatterns">
                 <property name="toolTip">
                  <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;A comma (',') separated list of filename patterns. A prefix of '-'  means inversion: if a filename matches it will not be found.&lt;/p&gt;&lt;p&gt;Example: *.txt,*.odt&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
                 </property>
                 </property>
                 <item>
                  <property name="text">
-                  <string>*,*~,*.bak</string>
+                  <string notr="true">*,-*~,-*.bak</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
-                  <string>*</string>
+                  <string notr="true">*</string>
                  </property>
                 </item>
                </widget>
                </widget>
               </item>
               <item>
-               <widget class="QComboBox" name="comboBoxDirPatterns">
+               <widget class="ReComboBox" name="comboBoxDirPatterns">
                 <property name="toolTip">
                  <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;A comma (',') separated list of directory name patterns. A prefix of '-'  means inversion: if a directory name matches it will not be found.&lt;/p&gt;&lt;p&gt;Example: *,-.git,-*cache*&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
                 </property>
                 </property>
                 <item>
                  <property name="text">
-                  <string>*,-*cache*,*thumbnails*</string>
+                  <string notr="true">*,-*cache*,-*thumbnails*</string>
                  </property>
                 </item>
                 <item>
                  <property name="text">
-                  <string>*</string>
+                  <string notr="true">*</string>
                  </property>
                 </item>
                </widget>
   </action>
  </widget>
  <layoutdefault spacing="6" margin="11"/>
+ <customwidgets>
+  <customwidget>
+   <class>ReComboBox</class>
+   <extends>QComboBox</extends>
+   <header>gui/ReComboBox.hpp</header>
+  </customwidget>
+ </customwidgets>
  <resources/>
  <connections>
   <connection>
index 8bda667832aa9decb021abce9f2f7b0eae927fae..495c549dae543fc8b104309b7836c51c54941b2b 100644 (file)
Binary files a/appl/rebackgui/rebackgui.de.qm and b/appl/rebackgui/rebackgui.de.qm differ
index 3c5b08178836ce133be74d576500a61f4c41ea30..534f7d4bda3fdbb845784bc3d9eea9fff5b7e790 100644 (file)
@@ -209,7 +209,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <location filename="mainwindow.ui" line="252"/>
-        <location filename="mainwindow.ui" line="881"/>
+        <location filename="mainwindow.ui" line="901"/>
         <source>Calculates checksums for source and target files and reports differences</source>
         <translation>Berechnet Prüfsummen für Quell- und Zieldateien und meldet Unterschiede</translation>
     </message>
@@ -236,8 +236,8 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <location filename="mainwindow.ui" line="305"/>
-        <location filename="mainwindow.ui" line="701"/>
-        <location filename="mainwindow.ui" line="754"/>
+        <location filename="mainwindow.ui" line="721"/>
+        <location filename="mainwindow.ui" line="774"/>
         <source>Clear</source>
         <translation>Löschen</translation>
     </message>
@@ -305,170 +305,196 @@ p, li { white-space: pre-wrap; }
         <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Eine Liste von Dateinamensmustern, getrennt mit Komma (&apos;,&apos;) . Ein Präfix &apos;-&apos;  bedeuted Umkehrung: Wenn ein Dateiname passt, wird er nicht gefunden.&lt;/p&gt;&lt;p&gt;Beispiel: *.txt,*.odt&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="591"/>
+        <location filename="mainwindow.ui" line="582"/>
+        <source>*,*~,*.bak</source>
+        <translation>*,*~,*.bak</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.ui" line="587"/>
+        <location filename="mainwindow.ui" line="620"/>
+        <source>*</source>
+        <translation>*</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.ui" line="601"/>
         <source>Dir patterns:</source>
         <translation>Verzeichnismuster:</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="598"/>
+        <location filename="mainwindow.ui" line="608"/>
         <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;A comma (&apos;,&apos;) separated list of directory name patterns. A prefix of &apos;-&apos;  means inversion: if a directory name matches it will not be found.&lt;/p&gt;&lt;p&gt;Example: *,-.git,-*cache*&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
         <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Eine Liste von Verzeichnisnamensmustern, getrennt mit Komma (&apos;,&apos;) . Ein Präfix &apos;-&apos;  bedeuted Umkehrung: Wenn ein Verzeichnisname passt, wird er nicht gefunden.&lt;/p&gt;&lt;p&gt;Beispiel: *,-.git,-*cache*&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="618"/>
+        <location filename="mainwindow.ui" line="615"/>
+        <source>*,-*cache*,*thumbnails*</source>
+        <translation>*,-*cache*,*thumbnails*</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.ui" line="638"/>
         <source>Source dirs:</source>
         <translation>Quelldateien:</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="644"/>
+        <location filename="mainwindow.ui" line="664"/>
         <source>Add source</source>
         <translation>Hinzufügen</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="657"/>
+        <location filename="mainwindow.ui" line="677"/>
         <source>Delete source</source>
         <translation>Löschen</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="674"/>
+        <location filename="mainwindow.ui" line="694"/>
         <source>Files</source>
         <translation>Dateien</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="688"/>
+        <location filename="mainwindow.ui" line="708"/>
         <source>File log:</source>
         <translation>Dateiliste:</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="727"/>
+        <location filename="mainwindow.ui" line="747"/>
         <source>Errors</source>
         <translation>Fehler</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="741"/>
+        <location filename="mainwindow.ui" line="761"/>
         <source>Error log:</source>
         <translation>Fehlerprotokoll:</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="800"/>
+        <location filename="mainwindow.ui" line="820"/>
         <source>Fi&amp;le</source>
         <oldsource>File</oldsource>
         <translatorcomment>Bearbeiten</translatorcomment>
         <translation>Datei</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="811"/>
+        <location filename="mainwindow.ui" line="831"/>
         <source>Edi&amp;t</source>
         <oldsource>Edit</oldsource>
         <translation>Bearbeiten</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="816"/>
+        <location filename="mainwindow.ui" line="836"/>
         <source>Hel&amp;p</source>
         <oldsource>Help</oldsource>
         <translation>Hilfe</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="825"/>
+        <location filename="mainwindow.ui" line="845"/>
         <source>A&amp;ction</source>
         <translation>Aktion</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="848"/>
+        <location filename="mainwindow.ui" line="868"/>
         <source>&amp;Load Config</source>
         <oldsource>Load Config</oldsource>
         <translation>Konfiguration laden</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="853"/>
+        <location filename="mainwindow.ui" line="873"/>
         <source>&amp;Save Config</source>
         <oldsource>Save Config</oldsource>
         <translation>Konfiguration sichern</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="858"/>
+        <location filename="mainwindow.ui" line="878"/>
         <source>&amp;Exit</source>
         <oldsource>Exit</oldsource>
         <translation>Beenden</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="863"/>
+        <location filename="mainwindow.ui" line="883"/>
         <source>&amp;Start backup</source>
         <oldsource>Start backup</oldsource>
         <translation>Sicherung starten</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="868"/>
+        <location filename="mainwindow.ui" line="888"/>
         <source>St&amp;op</source>
         <translation>Halt</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="873"/>
+        <location filename="mainwindow.ui" line="893"/>
         <source>&amp;About</source>
         <oldsource>About</oldsource>
         <translation>Über</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="878"/>
+        <location filename="mainwindow.ui" line="898"/>
         <source>&amp;Checksums</source>
         <translation>Prüfsummen</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="886"/>
+        <location filename="mainwindow.ui" line="906"/>
         <source>C&amp;lean</source>
         <translation>Löschen</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="894"/>
+        <location filename="mainwindow.ui" line="914"/>
         <source>&amp;English</source>
         <oldsource>English</oldsource>
         <translation>Englisch</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="902"/>
+        <location filename="mainwindow.ui" line="922"/>
         <source>&amp;German</source>
         <oldsource>German</oldsource>
         <translation>Deutsch</translation>
     </message>
     <message>
-        <location filename="mainwindow.ui" line="910"/>
+        <location filename="mainwindow.ui" line="930"/>
         <source>&amp;Autosave</source>
         <translation>&amp;Autom. speichern</translation>
     </message>
     <message>
-        <location filename="mainwindow.cpp" line="397"/>
-        <location filename="mainwindow.cpp" line="432"/>
-        <location filename="mainwindow.cpp" line="626"/>
+        <location filename="mainwindow.cpp" line="411"/>
+        <location filename="mainwindow.cpp" line="448"/>
+        <location filename="mainwindow.cpp" line="662"/>
         <source>no backup item selected</source>
         <translation>Kein Sicherungselement ausgewählt</translation>
     </message>
     <message>
-        <location filename="mainwindow.cpp" line="402"/>
-        <location filename="mainwindow.cpp" line="437"/>
-        <location filename="mainwindow.cpp" line="631"/>
+        <location filename="mainwindow.cpp" line="418"/>
+        <location filename="mainwindow.cpp" line="454"/>
+        <location filename="mainwindow.cpp" line="668"/>
         <source>Target not available</source>
         <translation>Ziel nicht vorhanden</translation>
     </message>
     <message>
-        <location filename="mainwindow.cpp" line="340"/>
+        <location filename="mainwindow.cpp" line="354"/>
         <source>Select Source Directory</source>
         <translation>Quellverzeichnis auswählen</translation>
     </message>
     <message>
-        <location filename="mainwindow.cpp" line="605"/>
+        <location filename="mainwindow.cpp" line="641"/>
         <source>Select Target Directory</source>
         <translation>Zielverzeichnis auswählen</translation>
     </message>
     <message>
-        <location filename="mainwindow.cpp" line="611"/>
+        <location filename="mainwindow.cpp" line="647"/>
         <source>target initialized with %1</source>
         <translation>Ziel mit %1 vorbelegt</translation>
     </message>
     <message>
-        <location filename="mainwindow.cpp" line="653"/>
+        <location filename="mainwindow.cpp" line="690"/>
         <source>Aborted by the user</source>
         <translation>Abbruch durch den Benutzer</translation>
     </message>
+    <message>
+        <location filename="mainwindow.cpp" line="983"/>
+        <source>device %1 successfully unmounted</source>
+        <translation>Gerät %1 erfolgreich entfernt</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.cpp" line="986"/>
+        <source>cannot unmount device %1: %2</source>
+        <translation>Kann das Gerät nicht entfernen: %1: %2</translation>
+    </message>
 </context>
 <context>
     <name>QObject</name>
@@ -483,142 +509,142 @@ p, li { white-space: pre-wrap; }
         <translation>kann Verzeichnis nicht anlegen (%1): %2</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="244"/>
-        <location filename="BackupEngine.cpp" line="452"/>
+        <location filename="BackupEngine.cpp" line="249"/>
+        <location filename="BackupEngine.cpp" line="457"/>
         <source>%1 of %2 (%3 of %4) %5 MB/sec runtime: %6</source>
         <translation>%1 von %2 (%3 von %4) %5 MB/sec Laufzeit: %6</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="255"/>
+        <location filename="BackupEngine.cpp" line="260"/>
         <source>backup complete after %1. Errors: %2</source>
         <translation>Sicherung nach %1 fertiggestellt Fehler: %2</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="305"/>
+        <location filename="BackupEngine.cpp" line="310"/>
         <source>cannot build checksum: %1</source>
         <translation>Kann Prüfsumme nicht ermitteln: %1</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="371"/>
+        <location filename="BackupEngine.cpp" line="376"/>
         <source>Building source checksum complete after %1. Processed: %2</source>
         <translation>Erzeugen der Prüfsummen für die Quelldateien fertig nach %1. Bearbeitet: %2</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="434"/>
+        <location filename="BackupEngine.cpp" line="439"/>
         <source>checksum differs: </source>
         <translation>Prüfsummen unterscheiden sich:</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="463"/>
+        <location filename="BackupEngine.cpp" line="468"/>
         <source>Building target checksums complete after %1. Processed: %2 Errors: %3</source>
         <translation>Erzeugen der Prüfsummen für die Zieldateien fertig nach %1. Bearbeitet: %2 Fehler: %3</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="530"/>
+        <location filename="BackupEngine.cpp" line="535"/>
         <source>cannot delete (%1): %2</source>
         <translation>Kann nicht löschen (%1): %2</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="539"/>
+        <location filename="BackupEngine.cpp" line="544"/>
         <source>cannot remove directory (%1): %2</source>
         <translation>Kann Verzeichnis nicht erstellen (%1): %2</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="553"/>
+        <location filename="BackupEngine.cpp" line="558"/>
         <source>cannot create the shadow directory: %1</source>
         <translation>Kann das Schattenverzeichnis nicht erstellen: %1</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="559"/>
+        <location filename="BackupEngine.cpp" line="564"/>
         <source>cannot delete shadow file (%1): %2</source>
         <translation>Kann Schattendatei nicht löschen (%1): %2</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="563"/>
+        <location filename="BackupEngine.cpp" line="568"/>
         <source>cannot rename target file (%1): %2 -&gt; %3</source>
         <translation>Kann Zieldatei nicht umbenennen (%1): %2 -&gt; %3</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="577"/>
+        <location filename="BackupEngine.cpp" line="582"/>
         <source>%1 of %2 files  %3 files/sec runtime: %6</source>
         <translation>%1 von %2 Dateien  %3 Dateien/sec Laufzeit: %6</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="585"/>
+        <location filename="BackupEngine.cpp" line="590"/>
         <source>clean complete after %1. Errors: %2</source>
         <translation>Bereinigen fertig nach %1. Fehler: %2</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="636"/>
+        <location filename="BackupEngine.cpp" line="641"/>
         <source>Search finished: to process: %1 with %2 matching: %3 total: %4 subdirs: %5 runtime: %6</source>
         <translation>Suche beendet: zu behandeln: %1 mit %2 passend: %3 gesamt: %4 Unterverz: %5 Laufzeit: %6</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="954"/>
+        <location filename="BackupEngine.cpp" line="959"/>
         <source>kann Schattenverzeichnis nicht umbenennen: %1 -&gt; %2</source>
         <translation>kann Schattenverzeichnis nicht umbenennen: %1 -&gt; %2</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="964"/>
+        <location filename="BackupEngine.cpp" line="969"/>
         <source>cannot create shadow directory (%1): %2</source>
         <translation>Kann Schattenverzeichnis nicht erstellen (%1): %2</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="969"/>
+        <location filename="BackupEngine.cpp" line="974"/>
         <source>cannot move to shadow directory (%1): %2 -&gt; %3</source>
         <translation>Kann Datei nicht in Schattenverzeichnis verschieben (%1): %2 -&gt; %3</translation>
     </message>
     <message>
-        <location filename="BackupEngine.cpp" line="994"/>
+        <location filename="BackupEngine.cpp" line="1000"/>
         <source>Search in target finished: to process: %1 with %2 dirs to delete: %3 total: %4 subdirs: %5 runtime: %6</source>
         <translation>Suche im Ziel bendet: zu behandeln: %1 mit %2 zu löschende Verzeichnisse: %3 gesamt: %4 Unterverz.: %5 Laufzeit: %6</translation>
     </message>
     <message>
-        <location filename="Configuration.cpp" line="68"/>
+        <location filename="Configuration.cpp" line="71"/>
         <source>item</source>
         <translation>Element</translation>
     </message>
     <message>
-        <location filename="Configuration.cpp" line="119"/>
-        <location filename="Configuration.cpp" line="205"/>
-        <location filename="../../base/ReFileUtils.cpp" line="208"/>
-        <location filename="../../base/ReFileUtils.cpp" line="212"/>
+        <location filename="Configuration.cpp" line="129"/>
+        <location filename="Configuration.cpp" line="227"/>
+        <location filename="../../base/ReFileUtils.cpp" line="213"/>
+        <location filename="../../base/ReFileUtils.cpp" line="217"/>
         <source>cannot open (%1): %2</source>
         <translation>Kann nicht öffnen (%1): %2</translation>
     </message>
     <message>
-        <location filename="Configuration.cpp" line="151"/>
+        <location filename="Configuration.cpp" line="161"/>
         <source>unknown format in %1-%2: %3</source>
         <translation>Unbekanntes Format in %1-%2: %3</translation>
     </message>
     <message>
-        <location filename="Configuration.cpp" line="226"/>
+        <location filename="Configuration.cpp" line="248"/>
         <source>cannot write (%1): %2</source>
         <translation>Kann nicht schreiben (%1): %2</translation>
     </message>
     <message>
-        <location filename="Configuration.cpp" line="230"/>
+        <location filename="Configuration.cpp" line="252"/>
         <source>configuration saved: %1</source>
         <oldsource>configuration changed: %1</oldsource>
         <translation>Konfiguration gespeichert: %1</translation>
     </message>
     <message>
-        <location filename="mainwindow.cpp" line="279"/>
+        <location filename="mainwindow.cpp" line="283"/>
         <source>Search started...</source>
         <translation>Suche gestartet...</translation>
     </message>
     <message>
-        <location filename="mainwindow.cpp" line="871"/>
+        <location filename="mainwindow.cpp" line="930"/>
         <source>yes</source>
         <translation>Ja</translation>
     </message>
     <message>
-        <location filename="mainwindow.cpp" line="871"/>
+        <location filename="mainwindow.cpp" line="930"/>
         <source>no</source>
         <translation>nein</translation>
     </message>
     <message>
-        <location filename="../../base/ReFileUtils.cpp" line="190"/>
+        <location filename="../../base/ReFileUtils.cpp" line="195"/>
         <source>not found: %1</source>
         <translation>Nicht gefunden: %1</translation>
     </message>
@@ -627,47 +653,47 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Kann nicht schreiben(%1): %2 [%3/%4]</translation>
     </message>
     <message>
-        <location filename="../../base/ReFileUtils.cpp" line="179"/>
+        <location filename="../../base/ReFileUtils.cpp" line="184"/>
         <source>copy file failed (%1): %2</source>
         <translation>Dateikopieren missglückt (%1): %2</translation>
     </message>
     <message>
-        <location filename="../../base/ReFileUtils.cpp" line="204"/>
+        <location filename="../../base/ReFileUtils.cpp" line="209"/>
         <source>not a regular file: %1</source>
         <translation>Keine normale Datei: %1</translation>
     </message>
     <message>
-        <location filename="../../base/ReFileUtils.cpp" line="229"/>
+        <location filename="../../base/ReFileUtils.cpp" line="234"/>
         <source>cannot write (%1): %2 [%3/%4]</source>
         <translation>Kann nicht schreiben(%1): %2 [%3/%4]</translation>
     </message>
     <message>
-        <location filename="../../base/ReFileUtils.cpp" line="236"/>
+        <location filename="../../base/ReFileUtils.cpp" line="241"/>
         <source>file can be read only partitionally: %1 [%2/%3]</source>
         <translation>Datei kann nur teilweise gelesen werden: %1 [%2/%3]</translation>
     </message>
     <message>
-        <location filename="../../base/ReFileUtils.cpp" line="241"/>
+        <location filename="../../base/ReFileUtils.cpp" line="246"/>
         <source>cannot set date/time (%1): %2</source>
         <translation>Kann Datum/Zeit nicht setzen (%1): %2</translation>
     </message>
     <message>
-        <location filename="../../base/ReFileUtils.cpp" line="244"/>
+        <location filename="../../base/ReFileUtils.cpp" line="249"/>
         <source>cannot set permissions (%1): %2</source>
         <translation>Kann Dateirechte nicht setzen (%1): %2</translation>
     </message>
     <message>
-        <location filename="../../base/ReFileUtils.cpp" line="254"/>
+        <location filename="../../base/ReFileUtils.cpp" line="259"/>
         <source>cannot set user/gid [%1/%2] (%3): %4</source>
         <translation>Kann Benutzer/Gruppe nicht setzen  [%1/%2] (%3): %4</translation>
     </message>
     <message>
-        <location filename="../../base/ReFileUtils.cpp" line="598"/>
+        <location filename="../../base/ReFileUtils.cpp" line="603"/>
         <source>can&apos;t create directory (%1): %2</source>
         <translation>Kann Verzeichnis nicht erzeugen (%1): %2</translation>
     </message>
     <message>
-        <location filename="../../base/ReFileUtils.cpp" line="604"/>
+        <location filename="../../base/ReFileUtils.cpp" line="609"/>
         <source>can&apos;t create directory (is a file): </source>
         <translation>Kann Verzeichnis nicht erzeugen (ist eine Datei): </translation>
     </message>
index ba86e1cd5bc5cce2a32ff6d5eea967d8959b8124..9e7410be2dc40e4a0231f5f07d04cd7582bdad61 100644 (file)
@@ -33,7 +33,8 @@ SOURCES += main.cpp\
         aboutdialog.cpp \
        Configuration.cpp \
        BackupEngine.cpp \
-       BackupUtils.cpp
+       BackupUtils.cpp \
+    ../../gui/ReComboBox.cpp
 
 HEADERS  += mainwindow.hpp \
         ../../base/rebase.hpp \
@@ -46,7 +47,8 @@ HEADERS  += mainwindow.hpp \
        Configuration.hpp \
        backupgui.hpp \
        BackupEngine.hpp \
-       BackupUtils.hpp
+       BackupUtils.hpp \
+    ../../gui/ReComboBox.hpp
 
 FORMS    += mainwindow.ui \
         aboutdialog.ui
index 99a8b24e710c0856975c5e9d8e30d07bbb527b6e..5815b74602e05f2cb16db565bb7a30f799a0c628 100644 (file)
@@ -949,7 +949,6 @@ ReSuccess_t ReFileUtils::setTimes(const char* filename, const QDateTime& modifie
        // QT solution:
        QString filename2(filename);
        QDir info(filename2);
-       if (info.set
        struct utimbuf times;
        times.actime = time_t(accessed.currentMSecsSinceEpoch() / 1000);
        times.modtime = time_t(modified.currentMSecsSinceEpoch() / 1000);
index 986fa58c3b517429328fb311a3a6a752a0b22659..2f93a66435cb22cc7eeaac96485d171f6676a133 100644 (file)
@@ -88,6 +88,7 @@ typedef int mode_t;
 #define _rmdir rmdir
 #define _unlink unlink
 #define _snprintf snprintf
+#define _strnicmp strnicmp
 //typedef qint64 uint64_t;
 #else
 #define S_ISDIR(mode) (((mode) & _S_IFDIR) != 0)
diff --git a/gui/ReComboBox.cpp b/gui/ReComboBox.cpp
new file mode 100644 (file)
index 0000000..2eea037
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Licence:
+ * You can use and modify this file without any restriction.
+ * There is no warranty.
+ * You also can use the licence from http://www.wtfpl.net/.
+ * The original sources can be found on https://github.com/republib.
+*/
+#include "base/rebase.hpp"
+#include "gui/regui.hpp"
+
+/**
+ * Constructor.
+ *
+ * @param parent       the widget which destroys the instance or <i>NULL</i>
+ */
+ReComboBox::ReComboBox(QWidget *parent) :
+       QComboBox(parent),
+       m_oldString(),
+       m_historySize(0)
+{
+}
+
+/**
+ * Event thrown if the focus comes to the instance.
+ *
+ * @param event        the event
+ */
+void ReComboBox::focusInEvent(QFocusEvent* event)
+{
+       if (event->gotFocus())
+               m_oldString = currentText();
+       QComboBox::focusInEvent(event);
+}
+
+/**
+ * Event thrown if the focus leaves the instance.
+ *
+ * @param event        the event
+ */
+void ReComboBox::focusOutEvent(QFocusEvent* event)
+{
+       if (event->lostFocus()){
+               QString current = currentText();
+               if (current != m_oldString){
+                       if (m_historySize > 0){
+                               int ix = findText(current);
+                               if (ix >= 0)
+                                       removeItem(ix);
+                               insertItem(0, current);
+                               if (count() > m_historySize)
+                                       removeItem(m_historySize);
+
+                       }
+                       comboTextEdited(m_oldString, current);
+               }
+       }
+       QComboBox::focusOutEvent(event);
+}
+
+/**
+ * Returns the number of history entries in the combobox list.
+ *
+ * @return     0: the history is not stored in the combobox list
+ *                     otherwise: the maximal number of entries
+ */
+int ReComboBox::historySize() const
+{
+       return m_historySize;
+}
+
+/**
+ * @brief ReComboBox::setHistorySize
+ * @param size
+ */
+void ReComboBox::setHistorySize(int size)
+{
+       m_historySize = size;
+}
diff --git a/gui/ReComboBox.hpp b/gui/ReComboBox.hpp
new file mode 100644 (file)
index 0000000..5cfa16c
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Licence:
+ * You can use and modify this file without any restriction.
+ * There is no warranty.
+ * You also can use the licence from http://www.wtfpl.net/.
+ * The original sources can be found on https://github.com/republib.
+*/
+
+#ifndef RECOMBOBOX_HPP
+#define RECOMBOBOX_HPP
+
+#include <QComboBox>
+#include <QFocusEvent>
+
+class ReComboBox : public QComboBox
+{
+       Q_OBJECT
+public:
+       explicit ReComboBox(QWidget *parent = 0);
+public:
+       int historySize() const;
+       void setHistorySize(int size);
+
+signals:
+       void comboTextEdited(const QString& oldText, const QString& newText);
+private:
+       virtual void focusInEvent(QFocusEvent* event);
+       virtual void focusOutEvent(QFocusEvent* event);
+private:
+       QString m_oldString;
+       int m_historySize;
+};
+
+#endif // RECOMBOBOX_HPP
index 6fb64513346426a36cb102850d623fbe6bf55e0c..566e3c609927c6380b2fe9cc2bd64f074577c308 100644 (file)
@@ -26,6 +26,7 @@
 #include "gui/ReEdit.hpp"
 #include "gui/ReSettings.hpp"
 #include "gui/ReFileTree.hpp"
+#include "gui/ReComboBox.hpp"
 
 /**
  * Tests whether a point is inside the rectangle (including border).