Beispiel #1
0
 void KeyOpenRecentChanges(object sender, EventArgs args)
 {
     manager.GtkInvoke(() => {
         NoteRecentChanges recent = NoteRecentChanges.GetInstance(manager);
         recent.Present();
     });
 }
Beispiel #2
0
        public void DisplaySearchWithText(string search_text)
        {
            NoteRecentChanges recent_changes =
                NoteRecentChanges.GetInstance(note_manager);

            if (recent_changes == null)
            {
                return;
            }

            recent_changes.SearchText = search_text;
            recent_changes.Present();
        }
Beispiel #3
0
        public static void OnRemoveBrokenLinksActivated()
        {
            NoteManager            def_note_manager;
            NoteRecentChanges      search;
            RemoveBrokenLinksUtils utils = new RemoveBrokenLinksUtils();

            def_note_manager = Tomboy.DefaultNoteManager;
            search           = NoteRecentChanges.GetInstance(def_note_manager);

            foreach (Note note in search.GetFilteredNotes())
            {
                utils.RemoveBrokenLinkTag(note);
                if ((bool)Preferences.Get(Preferences.ENABLE_WIKIWORDS))
                {
                    utils.HighlightWikiWords(note);
                }
            }
        }
Beispiel #4
0
 static void OpenSearchAll(object sender, EventArgs args)
 {
     NoteRecentChanges.GetInstance(manager).Present();
 }
Beispiel #5
0
 public void DisplaySearch()
 {
     NoteRecentChanges.GetInstance(note_manager).Present();
 }
Beispiel #6
0
        /// <summary>
        /// Called when the user chooses "Export Notebook"
        /// (Even when "All Notes or "Unfiled Notes" are
        /// selected.)
        /// </summary>
        void ExportNotebookButtonClicked(object sender, EventArgs args)
        {
            string output_folder        = null;
            ExportMultipleDialog dialog = null;

            Logger.Info("Activated export notebook to " + export_file_suffix);

            Notebook notebook = NoteRecentChanges.GetInstance(Tomboy.DefaultNoteManager).GetSelectedNotebook();

            try {
                //Handling the two special notebooks
                string notebook_name = notebook.NormalizedName;
                if (notebook_name == "___NotebookManager___AllNotes__Notebook___")
                {
                    Logger.Info("This notebook includes all notes, activating Export All");
                    ExportAllNotesViaGUI();
                    return;
                }
                else if (notebook_name == "___NotebookManager___UnfiledNotes__Notebook___")
                {
                    dialog = new ExportMultipleDialog(Catalog.GetString("Unfiled Notes"), export_type_pretty_name);
                    int response = dialog.Run();
                    output_folder = SanitizePath(dialog.Filename);
                    if (response != (int)Gtk.ResponseType.Ok)
                    {
                        Logger.Debug("User clicked cancel.");
                        dialog.Destroy();
                        return;
                    }

                    exporting_single_notebook = true;
                    Logger.Debug("Creating an export folder in: " + output_folder);
                    System.IO.Directory.CreateDirectory(output_folder);
                    ExportNotesInList(ListUnfiledNotes(), output_folder);
                }
                else
                {
                    //Ordinary notebooks
                    dialog = new ExportMultipleDialog(notebook_name, export_type_pretty_name);
                    int response = dialog.Run();
                    output_folder = SanitizePath(dialog.Filename);
                    if (response != (int)Gtk.ResponseType.Ok)
                    {
                        Logger.Debug("User clicked cancel.");
                        dialog.Destroy();
                        return;
                    }

                    exporting_single_notebook = true;
                    Logger.Debug("Creating an export folder in: " + output_folder);
                    System.IO.Directory.CreateDirectory(output_folder);
                    ExportNotesInList(notebook.Tag.Notes, output_folder);
                }

                //Successful export: clean up and inform.
                dialog.SavePreferences();
                ShowSuccessDialog(output_folder);
            } catch (UnauthorizedAccessException) {
                Logger.Error(Catalog.GetString("Could not export, access denied."));
                ShowErrorDialog(output_folder, dialog,
                                Catalog.GetString("Access denied."));
                return;
            } catch (DirectoryNotFoundException) {
                Logger.Error(Catalog.GetString("Could not export, folder does not exist."));
                ShowErrorDialog(output_folder, dialog,
                                Catalog.GetString("Folder does not exist."));
                return;
            } catch (Exception ex) {
                Logger.Error(Catalog.GetString("Could not export: {0}"), ex);
                ShowErrorDialog(output_folder, dialog,
                                Catalog.GetString("Unknown error."));
                return;
            } finally {
                if (dialog != null)
                {
                    dialog.Destroy();
                    dialog = null;
                }
            }
        }