aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/desktop-plugins/notepad
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-11-23 13:26:49 -0500
committerKen Moore <moorekou@gmail.com>2015-11-23 13:26:49 -0500
commit42b9bf131bc17f9fb0e7e9ead0c6f992eee11a2b (patch)
treee2932a8b22a5353e698d50823e8e842ff5e2fed3 /lumina-desktop/desktop-plugins/notepad
parentFix up the window minimization routines and the window margins for the embedd... (diff)
downloadlumina-42b9bf131bc17f9fb0e7e9ead0c6f992eee11a2b.tar.gz
lumina-42b9bf131bc17f9fb0e7e9ead0c6f992eee11a2b.tar.bz2
lumina-42b9bf131bc17f9fb0e7e9ead0c6f992eee11a2b.zip
A few fixes for the desktop:
1) Clean up the characters which are unsupported by the notepad for filenames (quotes of all kinds, semicolons, slashes) 2) Start Menu: allow clicks on the item text to trigger the launch, add the generic "comment" text underneath the name of the application (if available) in italics and indented. 3) Remove an extra processEvents call during session startup.
Diffstat (limited to 'lumina-desktop/desktop-plugins/notepad')
-rw-r--r--lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp18
-rw-r--r--lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h5
2 files changed, 20 insertions, 3 deletions
diff --git a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
index e229774d..bfb985d1 100644
--- a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
@@ -6,6 +6,7 @@
#include <QDir>
#include <QFileDialog>
#include <QInputDialog>
+#include <QtConcurrent>
NotePadPlugin::NotePadPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){
//qDebug() << "Creating Notepad Plugin:";
@@ -64,8 +65,8 @@ NotePadPlugin::NotePadPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID)
//qDebug() << "Connect Signals/slots";
//Setup the button connections
- connect(open, SIGNAL(clicked()), this, SLOT(openNote()) );
- connect(add, SIGNAL(clicked()), this, SLOT(newNote()) );
+ connect(open, SIGNAL(clicked()), this, SLOT(openNoteClicked()) );
+ connect(add, SIGNAL(clicked()), this, SLOT(newNoteClicked()) );
connect(rem, SIGNAL(clicked()), this, SLOT(remNote()) );
connect(edit, SIGNAL(textChanged()), this, SLOT(newTextAvailable()) );
connect(cnote, SIGNAL(currentIndexChanged(QString)), this, SLOT(noteChanged()) );
@@ -134,9 +135,12 @@ void NotePadPlugin::newNote(){
dlg.move( center.x()-(dlg.width()/2), center.y()-(dlg.height()/2) );
dlg.show();
while( dlg.isVisible() ){
+ //this->thread()->usleep(300000); //300 ms between updates
QApplication::processEvents();
}
QString name = dlg.textValue();
+ //make sure to remove any "bad" characters from the name
+ name.remove("\""); name.remove(";"); name.remove("\'"); name.replace("/","_");
if(name.isEmpty() || dlg.result()!=QDialog::Accepted){ return; } //cancelled
QString fullpath = QDir::homePath()+"/Notes/"+name;
if(!fullpath.endsWith(".note")){ fullpath.append(".note"); }
@@ -156,6 +160,16 @@ void NotePadPlugin::newNote(){
}
}
+void NotePadPlugin::openNoteClicked(){
+ //QtConcurrent::run(this, &NotePadPlugin::openNote);
+ openNote();
+}
+
+void NotePadPlugin::newNoteClicked(){
+ //QtConcurrent::run(this, &NotePadPlugin::newNote);
+ newNote();
+}
+
void NotePadPlugin::remNote(){
QString note = cnote->currentData().toString();
if(note.isEmpty()){ return; }
diff --git a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h
index 5a9ea2be..84935a11 100644
--- a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h
+++ b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h
@@ -36,9 +36,12 @@ private:
bool updating;
QTimer *typeTimer;
-private slots:
void openNote();
void newNote();
+
+private slots:
+ void openNoteClicked();
+ void newNoteClicked();
void remNote();
void newTextAvailable();
void updateContents();
bgstack15