[kde-doc-english] [kronometer/frameworks] /: Merge branch 'master' into frameworks

Elvis Angelaccio elvis.angelaccio at kdemail.net
Thu Sep 25 15:03:45 UTC 2014


Git commit d0496894ac68bd94a4db1b6729ef0825661242b3 by Elvis Angelaccio.
Committed on 25/09/2014 at 14:08.
Pushed by elvisangelaccio into branch 'frameworks'.

Merge branch 'master' into frameworks

Conflicts:
	src/kronometer.kcfg
	src/main.cpp
	src/mainwindow.cpp
	src/widgets/guisettings.ui

M  +8    -5    doc/index.docbook
M  +2    -0    src/CMakeLists.txt
M  +4    -0    src/kronometer.kcfg
M  +56   -77   src/lapmodel.cpp
M  +11   -2    src/main.cpp
M  +55   -24   src/mainwindow.cpp

http://commits.kde.org/kronometer/d0496894ac68bd94a4db1b6729ef0825661242b3

diff --cc src/kronometer.kcfg
index 8486049,d1eb7fb..c71f82b
--- a/src/kronometer.kcfg
+++ b/src/kronometer.kcfg
@@@ -104,6 -104,9 +104,10 @@@
          <entry name="showTimeHeaders" type="Bool">
              <default>true</default>
          </entry>
++
+         <entry name="isLapsRecordingEnabled" type="Bool">
+             <default>true</default>
+         </entry>
      </group>
  
  </kcfg>
diff --cc src/lapmodel.cpp
index 5c1ad8f,1430f88..af35e9c
--- a/src/lapmodel.cpp
+++ b/src/lapmodel.cpp
@@@ -19,10 -19,9 +19,9 @@@
  
  #include "lapmodel.h"
  
 -#include <KLocale>
 +#include <KLocalizedString>
  
  #include <QTime>
- #include <QDomElement>
  
  LapModel::LapModel(QObject* parent): QAbstractTableModel(parent) {}
  
diff --cc src/main.cpp
index 1fa3fb1,2266d7c..5285dac
--- a/src/main.cpp
+++ b/src/main.cpp
@@@ -17,43 -17,45 +17,52 @@@
      along with Kronometer.  If not, see <http://www.gnu.org/licenses/>.
  */
  
 -#include <KApplication>
 +#include <QApplication>
  #include <KAboutData>
 -#include <KCmdLineArgs> 
 -#include <KIcon>
 - 
 +#include <KLocalizedString>
 +
  #include "mainwindow.h"
 - 
 +
+ namespace
+ {
+     const QByteArray APP_NAME = "kronometer";
+     const QByteArray VERSION = "1.5.2";
+     const QByteArray OTHER_TEXT = "";
+     const QByteArray HOME_PAGE_ADDRESS = "http://aelog.org/kronometer";
++>>>>>>> master
+ 
 -    const QByteArray AUTHOR_EMAIL_ADDRESS = "elvis.angelaccio at kdemail.net";
 -    const QByteArray AUTHOR_WEB_ADDRESS = "http://aelog.org";
 -}
++#include "mainwindow.h"
+ 
  int main (int argc, char **argv)
  {
      KAboutData aboutData(
 -        APP_NAME, APP_NAME,
 -        ki18n("Kronometer"),
 -        VERSION,
 -        ki18n("Kronometer is a simple chronometer application built for KDE"),
 -        KAboutData::License_GPL,
 -        ki18n("Copyright (C) 2014 Elvis Angelaccio"),
 -        ki18n(OTHER_TEXT),
 -        HOME_PAGE_ADDRESS
 +        QStringLiteral("kronometer"),   // componentName
 +        i18n("Kronometer"), // displayName
-         QStringLiteral("1.4.1"),    // version
++        QStringLiteral("1.5.2"),    // version
 +        i18n("Kronometer is a simple stopwatch application built for KDE"), // shortDescription
 +        KAboutLicense::GPL_V2,    // licenseType
 +        i18n("Copyright (C) 2014 Elvis Angelaccio"),    // copyrightStatement
 +        QString(),  // otherText
 +        QStringLiteral("http://aelog.org/kronometer")   // homePageAddress
      );
  
 -    aboutData.addAuthor(ki18n("Elvis Angelaccio"), ki18n("Developer"), AUTHOR_EMAIL_ADDRESS, AUTHOR_WEB_ADDRESS);
 +    aboutData.addAuthor(
 +        i18n("Elvis Angelaccio"),
 +        i18n("Developer"),
 +        QStringLiteral("elvis.angelaccio at kdemail.net"),
 +        QStringLiteral("http://aelog.org")
 +    );
  
 -    KCmdLineArgs::init(argc, argv, &aboutData);
 +    KAboutData::setApplicationData(aboutData);
  
 -    KApplication app;
 +    QApplication app(argc, argv);
 +    app.setApplicationName(aboutData.componentName());
 +    app.setApplicationDisplayName(aboutData.displayName());
 +    app.setOrganizationDomain(aboutData.organizationDomain());
 +    app.setApplicationVersion(aboutData.version());
 +    app.setWindowIcon(QIcon::fromTheme("kronometer"));
  
      MainWindow* window = new MainWindow();
-     window->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
 -    window->setWindowIcon(KIcon("kronometer"));
      window->show();
  
      return app.exec();
diff --cc src/mainwindow.cpp
index 12b4dd8,c0bb20a..9648eb2
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@@ -218,9 -218,17 +219,17 @@@ void MainWindow::showSettings(
  void MainWindow::writeSettings(const QString& dialogName)
  {
      Q_UNUSED(dialogName);
 -    KronometerConfig::self()->writeConfig();
 +    KronometerConfig::self()->save();
  
-     loadSettings();
+     MainWindow *window = nullptr;
+ 
+     foreach (QWidget *widget, KApplication::topLevelWidgets()) {
+         window = qobject_cast<MainWindow *>(widget);
+ 
+         if (window) {
+             window->loadSettings();
+         }
+     }
  }
  
  void MainWindow::updateLapDock()
@@@ -487,40 -495,15 +494,35 @@@ bool MainWindow::saveFileAs(const QStri
      }
  }
  
 -void MainWindow::openFile(const QString& name)
 +void MainWindow::openUrl()
  {
 -    QString buffer;
 +    QString targetPath;
 +    bool ready = false;
 +
 +    if (saveUrl.isLocalFile()) {
 +        targetPath = saveUrl.toLocalFile();
 +        ready = true;
 +    }
 +
 +    else {
 +        QTemporaryFile tmpFile;
 +        tmpFile.open();
 +        QUrl tmpUrl = QUrl::fromLocalFile(tmpFile.fileName());
  
 -    if (KIO::NetAccess::download(name, buffer, this)) {
 -        QFile file(buffer);
 +        KIO::FileCopyJob *fileCopyJob = KIO::file_copy(saveUrl, tmpUrl, -1, KIO::Overwrite);
 +        ready = fileCopyJob->exec();
 +
 +        if (!ready) {
 +            fileCopyJob->uiDelegate()->showErrorMessage();
 +            close();  // files are opened in a new window, so if the open fails the new window has to be closed.
 +        }
 +    }
 +
 +    if (ready) {
 +        QFile file(targetPath);
          file.open(QIODevice::ReadOnly);
  
-         // OLD: persistence using binary files
-         //QDataStream stream(&file);
-         //stopwatch->deserialize(stream);     // load stopwatch time
-         //stream >> *lapModel;                // load laps
- 
-         // NEW: persistence using XML files
+         // Persistence using XML files
          QDomDocument doc;
          QString errorMsg;
  
@@@ -535,7 -522,8 +537,7 @@@
              }
          }
          else {
-             KMessageBox::error(this, "Cannot open file: " + errorMsg);
+             KMessageBox::error(this, i18n("Cannot open file: %1", errorMsg));
 -            KIO::NetAccess::removeTempFile(buffer);
              close();
          }
      }



More information about the kde-doc-english mailing list