diff options
author | Ken Moore <ken@pcbsd.org> | 2015-02-24 08:34:30 -0500 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2015-02-24 08:34:30 -0500 |
commit | b76ff12288cf220e0e572dd55b32499e76dc431c (patch) | |
tree | c91bc62d2719337e636cd6eb1ca6bc36355a10fe /lumina-fm/MainUI.cpp | |
parent | Merge pull request #58 from william-os4y/addNewFile2 (diff) | |
download | lumina-b76ff12288cf220e0e572dd55b32499e76dc431c.tar.gz lumina-b76ff12288cf220e0e572dd55b32499e76dc431c.tar.bz2 lumina-b76ff12288cf220e0e572dd55b32499e76dc431c.zip |
Clean up the new file creation routine a bit.
Diffstat (limited to 'lumina-fm/MainUI.cpp')
-rw-r--r-- | lumina-fm/MainUI.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index 298c3ee6..e2d0cbd2 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -857,11 +857,14 @@ void MainUI::on_tool_addNewFile_clicked(){ if(!ok || newdocument.isEmpty()){ return; } QString full = getCurrentDir(); if(!full.endsWith("/")){ full.append("/"); } - QDir dir(full); //open the current dir - QFile file(dir.filePath(newdocument)); - if (!file.open(QIODevice::ReadWrite)){ - QMessageBox::warning(this, tr("Error Creating Document"), tr("The document could not be created. Please ensure that you have the proper permissions.")); + QFile file(full+newdocument); + if(file.open(QIODevice::ReadWrite)){ + //If successfully opened, it has created a blank file + file.close(); + }else{ + QMessageBox::warning(this, tr("Error Creating Document"), tr("The document could not be created. Please ensure that you have the proper permissions.")); } + } void MainUI::tabChanged(int tab){ |