bug-fix: prompt for new notebook after mainwindow is shown

This commit is contained in:
Le Tan 2017-10-22 11:21:36 +08:00
parent be5f7d2b6b
commit 1028c9a4ad
4 changed files with 21 additions and 1 deletions

View File

@ -168,5 +168,7 @@ int main(int argc, char *argv[])
w.openFiles(filePaths); w.openFiles(filePaths);
w.promptNewNotebookIfEmpty();
return app.exec(); return app.exec();
} }

View File

@ -2623,3 +2623,10 @@ void VMainWindow::flushLogFileByCaptain(void *p_target, void *p_data)
g_logFile.flush(); g_logFile.flush();
#endif #endif
} }
void VMainWindow::promptNewNotebookIfEmpty()
{
if (vnote->getNotebooks().isEmpty()) {
notebookSelector->newNotebook();
}
}

View File

@ -83,6 +83,9 @@ public:
VCaptain *getCaptain() const; VCaptain *getCaptain() const;
// Prompt user for new notebook if there is no notebook.
void promptNewNotebookIfEmpty();
private slots: private slots:
void importNoteFromFile(); void importNoteFromFile();
void viewSettings(); void viewSettings();

View File

@ -243,7 +243,9 @@ void VNotebookSelector::handleCurIndexChanged(int p_index)
setCurrentIndex(m_lastValidIndex); setCurrentIndex(m_lastValidIndex);
} }
newNotebook(); if (!m_notebooks.isEmpty()) {
newNotebook();
}
return; return;
} }
@ -382,6 +384,12 @@ void VNotebookSelector::deleteNotebook(VNotebook *p_notebook, bool p_deleteFiles
QDesktopServices::openUrl(url); QDesktopServices::openUrl(url);
} }
} }
if (m_notebooks.isEmpty()) {
m_muted = true;
setCurrentIndex(0);
m_muted = false;
}
} }
void VNotebookSelector::editNotebookInfo() void VNotebookSelector::editNotebookInfo()