diff -r a4df85cb3fe9 -r eacf1b165d2d mainwindow.cpp --- a/mainwindow.cpp Wed Jun 20 11:58:47 2007 +0000 +++ b/mainwindow.cpp Wed Jun 20 11:58:47 2007 +0000 @@ -958,6 +958,13 @@ viewMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( viewZoomOut() ) ); + a = new QAction( QPixmap(iconPath+"viewshowsel.png"), tr( "Show selection","View action" ), this); + a->setStatusTip (tr( "Show selection" )); + a->setShortcut (Qt::Key_Period); + a->addTo( tb ); + viewMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( viewCenter() ) ); + viewMenu->addSeparator(); a = new QAction(QPixmap(flagsPath+"flag-note.png"), tr( "Show Note Editor","View action" ),this); @@ -1652,48 +1659,6 @@ if (actionViewToggleNoteEditor->isOn()) textEditor->showNormal(); } -bool Main::reallyWriteDirectory(const QString &dir) -{ - QStringList eList = QDir(dir).entryList(); - if (eList.first() ==".") eList.pop_front(); // remove "." - if (eList.first() =="..") eList.pop_front(); // remove "." - if (!eList.isEmpty()) - { - QMessageBox mb( vymName, - tr("The directory %1 is not empty.\nDo you risk to overwrite its contents?","write directory").arg(dir), - QMessageBox::Warning, - QMessageBox::Yes , - QMessageBox::Cancel | QMessageBox::Default, - QMessageBox::QMessageBox::NoButton ); - - mb.setButtonText( QMessageBox::Yes, tr("Overwrite") ); - mb.setButtonText( QMessageBox::No, tr("Cancel")); - switch( mb.exec() ) - { - case QMessageBox::Yes: - // save - return true; - case QMessageBox::Cancel: - // do nothing - return false; - } - } - return true; -} - -QString Main::browseDirectory (const QString &caption) -{ - QFileDialog fd(this,caption); - fd.setMode (QFileDialog::DirectoryOnly); - fd.setCaption(vymName+ " - "+caption); - fd.setDir (lastFileDir); - fd.show(); - - if ( fd.exec() == QDialog::Accepted ) - return fd.selectedFile(); - else - return ""; -} MapEditor* Main::currentMapEditor() const { @@ -2292,14 +2257,10 @@ currentMapEditor()->importDir(); } -void Main::fileExportXML() //FIXME not scriptable yet +void Main::fileExportXML() { - if (currentMapEditor()) - { - QString dir=browseDirectory(tr("Export XML to directory")); - if (dir !="" && reallyWriteDirectory(dir) ) - currentMapEditor()->exportXML(dir); - } + MapEditor *me=currentMapEditor(); + if (me) me->exportXML(); } @@ -3186,6 +3147,15 @@ } } +void Main::viewCenter() +{ + MapEditor *me=currentMapEditor(); + if (me) + { + me->ensureSelectionVisible(); + } +} + bool Main::settingsPDF() { // Default browser is set in constructor