1.1 --- a/mainwindow.cpp Wed Jun 20 11:58:47 2007 +0000
1.2 +++ b/mainwindow.cpp Wed Jun 20 11:58:47 2007 +0000
1.3 @@ -958,6 +958,13 @@
1.4 viewMenu->addAction (a);
1.5 connect( a, SIGNAL( triggered() ), this, SLOT( viewZoomOut() ) );
1.6
1.7 + a = new QAction( QPixmap(iconPath+"viewshowsel.png"), tr( "Show selection","View action" ), this);
1.8 + a->setStatusTip (tr( "Show selection" ));
1.9 + a->setShortcut (Qt::Key_Period);
1.10 + a->addTo( tb );
1.11 + viewMenu->addAction (a);
1.12 + connect( a, SIGNAL( triggered() ), this, SLOT( viewCenter() ) );
1.13 +
1.14 viewMenu->addSeparator();
1.15
1.16 a = new QAction(QPixmap(flagsPath+"flag-note.png"), tr( "Show Note Editor","View action" ),this);
1.17 @@ -1652,48 +1659,6 @@
1.18 if (actionViewToggleNoteEditor->isOn()) textEditor->showNormal();
1.19 }
1.20
1.21 -bool Main::reallyWriteDirectory(const QString &dir)
1.22 -{
1.23 - QStringList eList = QDir(dir).entryList();
1.24 - if (eList.first() ==".") eList.pop_front(); // remove "."
1.25 - if (eList.first() =="..") eList.pop_front(); // remove "."
1.26 - if (!eList.isEmpty())
1.27 - {
1.28 - QMessageBox mb( vymName,
1.29 - tr("The directory %1 is not empty.\nDo you risk to overwrite its contents?","write directory").arg(dir),
1.30 - QMessageBox::Warning,
1.31 - QMessageBox::Yes ,
1.32 - QMessageBox::Cancel | QMessageBox::Default,
1.33 - QMessageBox::QMessageBox::NoButton );
1.34 -
1.35 - mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
1.36 - mb.setButtonText( QMessageBox::No, tr("Cancel"));
1.37 - switch( mb.exec() )
1.38 - {
1.39 - case QMessageBox::Yes:
1.40 - // save
1.41 - return true;
1.42 - case QMessageBox::Cancel:
1.43 - // do nothing
1.44 - return false;
1.45 - }
1.46 - }
1.47 - return true;
1.48 -}
1.49 -
1.50 -QString Main::browseDirectory (const QString &caption)
1.51 -{
1.52 - QFileDialog fd(this,caption);
1.53 - fd.setMode (QFileDialog::DirectoryOnly);
1.54 - fd.setCaption(vymName+ " - "+caption);
1.55 - fd.setDir (lastFileDir);
1.56 - fd.show();
1.57 -
1.58 - if ( fd.exec() == QDialog::Accepted )
1.59 - return fd.selectedFile();
1.60 - else
1.61 - return "";
1.62 -}
1.63
1.64 MapEditor* Main::currentMapEditor() const
1.65 {
1.66 @@ -2292,14 +2257,10 @@
1.67 currentMapEditor()->importDir();
1.68 }
1.69
1.70 -void Main::fileExportXML() //FIXME not scriptable yet
1.71 +void Main::fileExportXML()
1.72 {
1.73 - if (currentMapEditor())
1.74 - {
1.75 - QString dir=browseDirectory(tr("Export XML to directory"));
1.76 - if (dir !="" && reallyWriteDirectory(dir) )
1.77 - currentMapEditor()->exportXML(dir);
1.78 - }
1.79 + MapEditor *me=currentMapEditor();
1.80 + if (me) me->exportXML();
1.81 }
1.82
1.83
1.84 @@ -3186,6 +3147,15 @@
1.85 }
1.86 }
1.87
1.88 +void Main::viewCenter()
1.89 +{
1.90 + MapEditor *me=currentMapEditor();
1.91 + if (me)
1.92 + {
1.93 + me->ensureSelectionVisible();
1.94 + }
1.95 +}
1.96 +
1.97 bool Main::settingsPDF()
1.98 {
1.99 // Default browser is set in constructor