aboutsummaryrefslogtreecommitdiff
path: root/lumina-fm
diff options
context:
space:
mode:
authorwilliam os4y <william.os4y@gmail.com>2015-02-22 19:56:13 +0100
committerwilliam os4y <william.os4y@gmail.com>2015-02-23 19:23:48 +0100
commitdd2e7baadb28a60b8581c7cc61a04a7699a94cea (patch)
treeb0e683209012e253481aefd469b4cb5d77b2952f /lumina-fm
parentUpdate the ROADMAP to 1.0.0-Release (diff)
downloadlumina-dd2e7baadb28a60b8581c7cc61a04a7699a94cea.tar.gz
lumina-dd2e7baadb28a60b8581c7cc61a04a7699a94cea.tar.bz2
lumina-dd2e7baadb28a60b8581c7cc61a04a7699a94cea.zip
add "New file" on lumina-fm
Diffstat (limited to 'lumina-fm')
-rw-r--r--lumina-fm/MainUI.cpp16
-rw-r--r--lumina-fm/MainUI.h3
-rw-r--r--lumina-fm/MainUI.ui19
3 files changed, 37 insertions, 1 deletions
diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp
index 1b01a855..72176e55 100644
--- a/lumina-fm/MainUI.cpp
+++ b/lumina-fm/MainUI.cpp
@@ -159,6 +159,7 @@ void MainUI::setupIcons(){
ui->actionScan->setIcon( LXDG::findIcon("system-search","") );
//Browser page
+ ui->tool_addNewFile->setIcon( LXDG::findIcon("document-new",""));
ui->tool_addToDir->setIcon( LXDG::findIcon("folder-new","") );
ui->tool_goToImages->setIcon( LXDG::findIcon("fileview-preview","") );
ui->tool_goToPlayer->setIcon( LXDG::findIcon("applications-multimedia","") );
@@ -442,6 +443,7 @@ void MainUI::setCurrentDir(QString dir){
if(isUserWritable){ ui->label_dir_stats->setText(""); }
else{ ui->label_dir_stats->setText(tr("Limited Access Directory")); }
ui->tool_addToDir->setVisible(isUserWritable);
+ ui->tool_addNewFile->setVisible(isUserWritable);
ui->actionUpDir->setEnabled(dir!="/");
ui->actionBack->setEnabled(history.length() > 1);
ui->actionBookMark->setEnabled( rawdir!=QDir::homePath() && settings->value("bookmarks", QStringList()).toStringList().filter("::::"+rawdir).length()<1 );
@@ -788,6 +790,20 @@ void MainUI::on_tool_addToDir_clicked(){
}
}
+void MainUI::on_tool_addNewFile_clicked(){
+ bool ok = false;
+ QString newdocument = QInputDialog::getText(this, tr("New Document"), tr("Name:"), QLineEdit::Normal, "", \
+ &ok, 0, Qt::ImhFormattedNumbersOnly | Qt::ImhUppercaseOnly | Qt::ImhLowercaseOnly);
+ 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."));
+ }
+}
+
void MainUI::tabChanged(int tab){
//Load the directory contained in the new tab
qDebug() << "Change to Tab:" << tab << tabBar->tabText(tab);
diff --git a/lumina-fm/MainUI.h b/lumina-fm/MainUI.h
index ccc85f72..ba390cb0 100644
--- a/lumina-fm/MainUI.h
+++ b/lumina-fm/MainUI.h
@@ -157,7 +157,8 @@ private slots:
void reloadDirectory(); //Update the widget with the dir contents
void currentDirectoryLoaded(); //The file system model re-loaded the directory
void on_tool_addToDir_clicked();
- void tabChanged(int tab);
+ void on_tool_addNewFile_clicked();
+ void tabChanged(int tab);
void tabClosed(int tab = -1);
void prevTab();
void nextTab();
diff --git a/lumina-fm/MainUI.ui b/lumina-fm/MainUI.ui
index 9dae7a56..5cdb35e8 100644
--- a/lumina-fm/MainUI.ui
+++ b/lumina-fm/MainUI.ui
@@ -422,6 +422,25 @@
</widget>
</item>
<item>
+ <widget class="QToolButton" name="tool_addNewFile">
+ <property name="statusTip">
+ <string>Create a new file</string>
+ </property>
+ <property name="text">
+ <string>New &amp;file</string>
+ </property>
+ <property name="popupMode">
+ <enum>QToolButton::InstantPopup</enum>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QToolButton" name="tool_addToDir">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
bgstack15