KStandardAction::paste(this, SLOT(slotPaste()),
actionCollection());
- KStandardAction::undo(this, SLOT(undo()),
- actionCollection());
+ KAction *undo = KStandardAction::undo(m_commandStack, SLOT(undo()),
+ actionCollection());
+ undo->setEnabled(false);
+ connect(m_commandStack, SIGNAL(canUndoChanged(bool)), undo, SLOT(setEnabled(bool)));
- KStandardAction::redo(this, SLOT(redo()),
- actionCollection());
+ KAction *redo = KStandardAction::redo(m_commandStack, SLOT(redo()),
+ actionCollection());
+ redo->setEnabled(false);
+ connect(m_commandStack, SIGNAL(canRedoChanged(bool)), redo, SLOT(setEnabled(bool)));
KStandardAction::fullScreen(this, SLOT(slotFullScreen()), this, actionCollection());
readOptions();
}
-void MainWindow::undo() {
- m_commandStack->undo();
-}
-
-void MainWindow::redo() {
- m_commandStack->redo();
-}
-
void MainWindow::slotDisplayActionMessage(QAction *a) {
statusBar()->showMessage(a->data().toString(), 3000);
}
void MainWindow::openLastFile() {
KSharedConfigPtr config = KGlobal::config();
- QString Lastproject = config->group("Recent Files").readPathEntry("File1", QString());
- openFile(KUrl(Lastproject));
+ KUrl::List urls = m_fileOpenRecent->urls();
+ if (urls.isEmpty()) newFile();
+ else openFile(urls.last());
}
void MainWindow::openFile(const KUrl &url) {