• Skip to content
  • Skip to link menu
KDE API Documentation - File.h Source File (GCompris-qt)
  • KDE Home
  • Contact Us
 

GCompris-qt

  • src
  • core
File.h
1 /* GCompris - File.h
2  *
3  * Copyright (C) 2014 Holger Kaelberer <holger.k@elberer.de>
4  *
5  * Authors:
6  * Holger Kaelberer <holger.k@elberer.de>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef FILE_H
23 #define FILE_H
24 
25 #include <QObject>
26 #include <QString>
27 
34 class File : public QObject
35 {
36  Q_OBJECT
37 
44  Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
45 
46 public:
50  explicit File(QObject *parent = 0);
51 
60  Q_INVOKABLE QString read(const QString& name = QString());
61 
71  Q_INVOKABLE bool write(const QString& data, const QString& name = QString());
72 
79  Q_INVOKABLE static bool exists(const QString& path);
80 
82  static void init();
83  QString name() const;
84  void setName(const QString &str);
86 
87 signals:
91  void nameChanged();
92 
98  void error(const QString& msg);
99 
100 private:
101  QString m_name;
102 
103  static QString sanitizeUrl(const QString& url);
104 };
105 
106 #endif
File::name
QString name
Filename.
Definition: File.h:44
File::error
void error(const QString &msg)
Emitted when an error occurs.
File::read
Q_INVOKABLE QString read(const QString &name=QString())
Reads contents of a file.
Definition: File.cpp:61
File::exists
static Q_INVOKABLE bool exists(const QString &path)
Checks whether file path exists.
Definition: File.cpp:122
File::write
Q_INVOKABLE bool write(const QString &data, const QString &name=QString())
Writes data to a file.
Definition: File.cpp:93
File::nameChanged
void nameChanged()
Emitted when the name changes.
File::File
File(QObject *parent=0)
Constructor.
Definition: File.cpp:29
File
A helper component for accessing local files from QML.
Definition: File.h:34
This file is part of the KDE documentation.
Documentation copyright © 1996-2015 The KDE developers.
Generated on Tue Jun 2 2015 21:47:47 by doxygen 1.8.9.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

GCompris-qt

Skip menu "GCompris-qt"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • File List
  • Modules

Class Picker

Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal