summaryrefslogtreecommitdiffstats
path: root/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp')
-rw-r--r--examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp
index bdf450eb..dd4a5546 100644
--- a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp
+++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp
@@ -48,10 +48,10 @@ Initialize the saves directory and creates the file list
*/
Directory::Directory(QObject *parent) : QObject(parent)
{
-
+
m_dir.cd( QDir::currentPath());
-
+
//go to the saved directory. if not found, create save directory
m_saveDir = "saves";
if (m_dir.cd(m_saveDir) == 0){
@@ -144,7 +144,7 @@ void Directory::setFileContent(const QString &str){
if(str != m_fileContent){
m_fileContent = str;
emit fileContentChanged();
- }
+ }
}
/*
@@ -152,17 +152,17 @@ Called from QML to save the file using the filename and file content.
Saving makes sure that the file has a .txt extension.
*/
void Directory::saveFile(){
-
+
if(currentFile.name().size() == 0){
qWarning()<< "Empty filename. no save";
return;
}
-
+
QString extendedName = currentFile.name();
if(!currentFile.name().endsWith(".txt")){
extendedName.append(".txt");
}
-
+
QFile file( m_dir.filePath(extendedName) );
if (file.open(QFile::WriteOnly | QFile::Truncate)){
QTextStream outStream(&file);
@@ -184,11 +184,11 @@ void Directory::loadFile(){
if(!currentFile.name().endsWith(".txt")){
extendedName.append(".txt");
}
-
+
QFile file( m_dir.filePath(extendedName) );
if (file.open(QFile::ReadOnly )){
QTextStream inStream(&file);
-
+
QString line;
do{
line = inStream.read(75);
@@ -205,12 +205,12 @@ created files are added onto the list.
void Directory::refresh(){
m_dirFiles = m_dir.entryList(m_filterList,QDir::Files,QDir::Name);
m_fileList.clear();
-
+
File * file;
for(int i = 0; i < m_dirFiles.size() ; i ++){
-
+
file = new File();
-
+
if(m_dirFiles.at(i).endsWith(".txt")){
QString name = m_dirFiles.at(i);
file->setName( name.remove(".txt",Qt::CaseSensitive));