author | wazlaf <wazlaf> | 2002-10-24 20:40:24 (UTC) |
---|---|---|
committer | wazlaf <wazlaf> | 2002-10-24 20:40:24 (UTC) |
commit | 0fc598a0ee9151f82f5a78383645a758d5f6cad9 (patch) (side-by-side diff) | |
tree | d7b6df2344aafe89f914d796d941ef6fd705cff4 | |
parent | b3d13ad799eebbee3a1a73c4fe5b38167070ab87 (diff) | |
download | opie-0fc598a0ee9151f82f5a78383645a758d5f6cad9.zip opie-0fc598a0ee9151f82f5a78383645a758d5f6cad9.tar.gz opie-0fc598a0ee9151f82f5a78383645a758d5f6cad9.tar.bz2 |
only use .script files, set DocLnk names correctly
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 888ab90..ccecdf8 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -10,2 +10,3 @@ #include <qwhatsthis.h> +#include <qfileinfo.h> @@ -143,2 +144,3 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow( m_manager->load(); + m_scriptsData.setAutoDelete(TRUE); @@ -360,4 +362,7 @@ void MainWindow::populateScripts() { if (*dit && (*dit)->name().length()>0) { - m_scriptsData.append((*dit)); - m_scriptsPop->insertItem((*dit)->name()); + QFileInfo info((*dit)->file()); + if (info.extension(false) == "script") { + m_scriptsData.append(new DocLnk(**dit)); + m_scriptsPop->insertItem((*dit)->name()); + } } @@ -410,2 +415,5 @@ void MainWindow::slotSaveScript() { if (!filename.isEmpty()) { + QFileInfo info(filename); + if (info.extension(FALSE) != "script") + filename += ".script"; DocLnk nf; @@ -413,3 +421,3 @@ void MainWindow::slotSaveScript() { nf.setFile(filename); - nf.setName(filename); + nf.setName(info.fileName()); FileManager fm; @@ -426,5 +434,5 @@ void MainWindow::slotRunScript(int id) { if (currentSession()) { - DocLnk *lnk = m_scriptsData.at(m_scriptsPop->indexOf(id)); + int index = m_scriptsPop->indexOf(id); + DocLnk *lnk = m_scriptsData.at(index); QString filePath = lnk->file(); - printf("path is : %s\n", filePath.latin1()); Script script(filePath); |