GpgFrontend Project A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.

Public Slots | Public Member Functions | Public Attributes | Protected Member Functions | Private Slots | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
GpgFrontend::UI::TextEdit Class Reference

TextEdit class. More...

`#include <TextEdit.h>`

Inheritance diagram for GpgFrontend::UI::TextEdit:
Collaboration diagram for GpgFrontend::UI::TextEdit:

## Public Slots
PlainTextEditorPage * | SlotCurPageTextEdit () const
FilePage * | SlotCurPageFileTreeView () const
void | SlotQuote () const
void | SlotFillTextEditWithText (const QString &text) const
void | SlotSave ()
bool | SlotSaveAs ()
void | SlotOpen ()
void | SlotPrint ()
void | SlotNewTab ()
void | SlotNewTabWithContent (std::string title, const std::string &content)
void | SlotOpenFile (const QString &path)
void | slotNewHelpTab (const QString &title, const QString &path) const
void | SlotNewFileTab () const
void | SlotShowModified (bool) const
void | SlotCloseTab ()
void | SlotSwitchTabUp () const
void | SlotSwitchTabDown () const
void | SlotCut () const
void | SlotCopy () const
void | SlotPaste () const
void | SlotUndo () const
void | SlotRedo () const
| redo last change in current text page
void | SlotZoomIn () const
void | SlotZoomOut () const
void | SlotSelectAll () const
| select all in current text page

## Public Member Functions
| TextEdit (QWidget *parent)
void | LoadFile (const QString &fileName)
bool | MaybeSaveAnyTab ()
int | TabCount () const
PlainTextEditorPage * | CurTextPage () const
FilePage * | CurFilePage () const
QHash< int, QString > | UnsavedDocuments () const

## Public Attributes
QTabWidget * | tab_widget_

## Protected Member Functions
bool | save_file (const QString &fileName)
| Saves the content of currentTab to the file filename. More...

## Private Slots
void | slot_file_page_path_changed (const QString &path) const
void | slot_remove_tab (int index)
void | slot_save_status_to_cache_for_revovery ()

## Private Member Functions
bool | maybe_save_current_tab (bool askToSave)

## Static Private Member Functions
static QString | stripped_name (const QString &full_file_name)

## Private Attributes
uint | text_page_data_modified_count_ = 0
int | count_page_
| int containing the number of added tabs

## Detailed Description

TextEdit class.

## Member Function Documentation

## ◆ CurFilePage()

FilePage * GpgFrontend::UI::TextEdit::CurFilePage | ( |  | ) | const

Returns
  FilePage*

Referenced by GpgFrontend::UI::MainWindow::slot_disable_tab_actions().

## ◆ CurTextPage()

PlainTextEditorPage * GpgFrontend::UI::TextEdit::CurTextPage | ( |  | ) | const

textpage of the currently activated tab

Returns
  - reference to QTextEdit if tab has one
  - 0 otherwise (e.g. if helppage)

Referenced by GpgFrontend::UI::MainWindow::slot_add_pgp_header(), GpgFrontend::UI::MainWindow::slot_append_selected_keys(), GpgFrontend::UI::MainWindow::slot_clean_double_line_breaks(), GpgFrontend::UI::MainWindow::slot_cut_pgp_header(), GpgFrontend::UI::MainWindow::slot_decrypt(), GpgFrontend::UI::MainWindow::slot_decrypt_verify(), GpgFrontend::UI::MainWindow::slot_encrypt(), GpgFrontend::UI::MainWindow::slot_encrypt_sign(), GpgFrontend::UI::MainWindow::slot_find(), GpgFrontend::UI::MainWindow::slot_import_key_from_edit(), GpgFrontend::UI::MainWindow::slot_sign(), and GpgFrontend::UI::MainWindow::slot_verify().

## ◆ LoadFile()

void GpgFrontend::UI::TextEdit::LoadFile | ( | const QString & | fileName | ) |

Load the content of file into the current textpage

Parameters

  fileName | QString containing the filename to load

Returns
  nothing

## ◆ maybe_save_current_tab()

bool GpgFrontend::UI::TextEdit::maybe_save_current_tab | ( | bool | askToSave | ) |
| private

Parameters

  askToSave | Check if current may need to be saved. Call this function before closing the currently active tab-

If it returns false, the close event should be aborted.

References GpgFrontend::UI::PlainTextEditorPage::GetFilePath(), GpgFrontend::UI::PlainTextEditorPage::GetTextPage(), and GpgFrontend::UI::PlainTextEditorPage::ReadDone().

## ◆ MaybeSaveAnyTab()

bool GpgFrontend::UI::TextEdit::MaybeSaveAnyTab | ( |  | ) |

Checks if there are unsaved documents in any tab, which may need to be saved. Call this function before closing the programme or all tabs.

Returns
  - false, if the close event should be aborted.
  - true, otherwise

References GpgFrontend::UI::QuitDialog::GetTabIdsToSave(), and GpgFrontend::UI::QuitDialog::IsDiscarded().

Referenced by GpgFrontend::UI::MainWindow::slot_open_settings_dialog().

## ◆ save_file()

bool GpgFrontend::UI::TextEdit::save_file | ( | const QString & | fileName | ) |
| protected

Saves the content of currentTab to the file filename.

Parameters

  fileName |

References GpgFrontend::UI::PlainTextEditorPage::GetTextPage(), GpgFrontend::UI::PlainTextEditorPage::NotifyFileSaved(), GpgFrontend::UI::PlainTextEditorPage::SetFilePath(), and GpgFrontend::UI::PlainTextEditorPage::WillCharsetChange().

## ◆ slot_remove_tab

void GpgFrontend::UI::TextEdit::slot_remove_tab | ( | int | index | ) |
| private slot

Remove the tab with given index

Parameters

  index | Tab-number to remove

## ◆ slot_save_status_to_cache_for_revovery

void GpgFrontend::UI::TextEdit::slot_save_status_to_cache_for_revovery | ( |  | ) |
| private slot

Parameters

  index |

## ◆ SlotCloseTab

void GpgFrontend::UI::TextEdit::SlotCloseTab | ( |  | ) |
| slot

close the current tab and decrease TabWidget->count by 1

Referenced by GpgFrontend::UI::MainWindow::create_actions().

## ◆ SlotCopy

void GpgFrontend::UI::TextEdit::SlotCopy | ( |  | ) | const
| slot

Copy selected text of current text page to clipboard.

Referenced by GpgFrontend::UI::MainWindow::create_actions().

## ◆ SlotCurPageFileTreeView

FilePage * GpgFrontend::UI::TextEdit::SlotCurPageFileTreeView | ( |  | ) | const
| slot

Return pointer to the currently activated file tree view tab page.

Referenced by GpgFrontend::UI::MainWindow::slot_decrypt(), GpgFrontend::UI::MainWindow::slot_decrypt_verify(), GpgFrontend::UI::MainWindow::slot_encrypt(), GpgFrontend::UI::MainWindow::slot_encrypt_sign(), GpgFrontend::UI::MainWindow::slot_sign(), GpgFrontend::UI::MainWindow::slot_verify(), GpgFrontend::UI::MainWindow::SlotFileDecrypt(), GpgFrontend::UI::MainWindow::SlotFileDecryptVerify(), GpgFrontend::UI::MainWindow::SlotFileEncrypt(), GpgFrontend::UI::MainWindow::SlotFileEncryptSign(), GpgFrontend::UI::MainWindow::SlotFileSign(), and GpgFrontend::UI::MainWindow::SlotFileVerify().

## ◆ SlotCurPageTextEdit

PlainTextEditorPage * GpgFrontend::UI::TextEdit::SlotCurPageTextEdit | ( |  | ) | const
| slot

Widget containing the tabs of the editor

Return pointer to the currently activated text edit tab page.

Referenced by GpgFrontend::UI::MainWindow::slot_add_pgp_header(), GpgFrontend::UI::MainWindow::slot_append_selected_keys(), GpgFrontend::UI::MainWindow::slot_clean_double_line_breaks(), GpgFrontend::UI::MainWindow::slot_cut_pgp_header(), GpgFrontend::UI::MainWindow::slot_decrypt(), GpgFrontend::UI::MainWindow::slot_decrypt_verify(), GpgFrontend::UI::MainWindow::slot_encrypt(), GpgFrontend::UI::MainWindow::slot_encrypt_sign(), GpgFrontend::UI::MainWindow::slot_find(), GpgFrontend::UI::MainWindow::slot_import_key_from_edit(), GpgFrontend::UI::MainWindow::slot_sign(), and GpgFrontend::UI::MainWindow::slot_verify().

## ◆ SlotCut

void GpgFrontend::UI::TextEdit::SlotCut | ( |  | ) | const
| slot

Cut selected text in current text page.

Referenced by GpgFrontend::UI::MainWindow::create_actions().

## ◆ SlotFillTextEditWithText

void GpgFrontend::UI::TextEdit::SlotFillTextEditWithText | ( | const QString & | text | ) | const
| slot

replace the text of currently active textedit with given text.

Parameters

  text | to fill on.

Referenced by GpgFrontend::UI::MainWindow::slot_add_pgp_header(), GpgFrontend::UI::MainWindow::slot_clean_double_line_breaks(), GpgFrontend::UI::MainWindow::slot_cut_pgp_header(), GpgFrontend::UI::MainWindow::slot_decrypt(), GpgFrontend::UI::MainWindow::slot_decrypt_verify(), GpgFrontend::UI::MainWindow::slot_encrypt(), GpgFrontend::UI::MainWindow::slot_encrypt_sign(), and GpgFrontend::UI::MainWindow::slot_sign().

## ◆ SlotNewFileTab

void GpgFrontend::UI::TextEdit::SlotNewFileTab | ( |  | ) | const
| slot

New File Tab to do file operation

Referenced by GpgFrontend::UI::MainWindow::slot_open_file_tab().

## ◆ slotNewHelpTab

void GpgFrontend::UI::TextEdit::slotNewHelpTab | ( | const QString & | title,
|  | const QString & | path
| ) |  | const
| slot

Adds a new tab with the given title and opens given html file. Increase Tab-Count by one

Parameters

  title | title for the tab
  path | path for html file to show

## ◆ SlotNewTab

void GpgFrontend::UI::TextEdit::SlotNewTab | ( |  | ) |
| slot

Adds a new tab with the title "untitled"+countpage+".txt" Sets the focus to the new tab. Increase Tab-Count by one

Referenced by GpgFrontend::UI::MainWindow::create_actions().

## ◆ SlotOpen

void GpgFrontend::UI::TextEdit::SlotOpen | ( |  | ) |
| slot

Show an OpenFileDoalog and open the file in a new tab. Shows an error dialog, if the open fails. Set the focus to the tab of the opened file.

Referenced by GpgFrontend::UI::MainWindow::create_actions().

## ◆ SlotOpenFile

void GpgFrontend::UI::TextEdit::SlotOpenFile | ( | const QString & | path | ) |
| slot

Adds a new tab with opening file by path

Referenced by GpgFrontend::UI::MainWindow::SlotOpenFile().

## ◆ SlotPaste

void GpgFrontend::UI::TextEdit::SlotPaste | ( |  | ) | const
| slot

Paste text from clipboard to current text page.

Referenced by GpgFrontend::UI::MainWindow::create_actions().

## ◆ SlotPrint

void GpgFrontend::UI::TextEdit::SlotPrint | ( |  | ) |
| slot

Open a print-dialog for the current tab

Referenced by GpgFrontend::UI::MainWindow::create_actions().

## ◆ SlotQuote

void GpgFrontend::UI::TextEdit::SlotQuote | ( |  | ) | const
| slot

Insert a ">" at the beginning of every line of current textedit.

Referenced by GpgFrontend::UI::MainWindow::create_actions().

## ◆ SlotSave

void GpgFrontend::UI::TextEdit::SlotSave | ( |  | ) |
| slot

Saves the content of the current tab, if it has a filepath otherwise it calls saveAs for the current tab

Referenced by GpgFrontend::UI::MainWindow::create_actions().

## ◆ SlotSaveAs

bool GpgFrontend::UI::TextEdit::SlotSaveAs | ( |  | ) |
| slot

Opens a savefiledialog and calls save_file with the choosen filename.

Returns
  Return the return value of the savefile method

References GpgFrontend::UI::PlainTextEditorPage::GetFilePath().

Referenced by GpgFrontend::UI::MainWindow::create_actions().

## ◆ SlotShowModified

void GpgFrontend::UI::TextEdit::SlotShowModified | ( | bool | changed | ) | const
| slot

put a * in front of current tabs title, if current textedit is modified

## ◆ SlotSwitchTabDown

void GpgFrontend::UI::TextEdit::SlotSwitchTabDown | ( |  | ) | const
| slot

Switch to the previous tab.

Referenced by GpgFrontend::UI::MainWindow::create_actions().

## ◆ SlotSwitchTabUp

void GpgFrontend::UI::TextEdit::SlotSwitchTabUp | ( |  | ) | const
| slot

Switch to the next tab.

Referenced by GpgFrontend::UI::MainWindow::create_actions().

## ◆ SlotUndo

void GpgFrontend::UI::TextEdit::SlotUndo | ( |  | ) | const
| slot

Undo last change in current textpage.

Referenced by GpgFrontend::UI::MainWindow::create_actions().

## ◆ stripped_name()

QString GpgFrontend::UI::TextEdit::stripped_name | ( | const QString & | full_file_name | ) |
| static private

return just a filename stripped of a whole path

Parameters

  a | filename path

Returns
  QString containing the filename

## ◆ TabCount()

int GpgFrontend::UI::TextEdit::TabCount | ( |  | ) | const

Returns
  int

Referenced by GpgFrontend::UI::MainWindow::slot_add_pgp_header(), GpgFrontend::UI::MainWindow::slot_append_selected_keys(), GpgFrontend::UI::MainWindow::slot_clean_double_line_breaks(), GpgFrontend::UI::MainWindow::slot_cut_pgp_header(), GpgFrontend::UI::MainWindow::slot_decrypt(), GpgFrontend::UI::MainWindow::slot_decrypt_verify(), GpgFrontend::UI::MainWindow::slot_encrypt(), GpgFrontend::UI::MainWindow::slot_encrypt_sign(), GpgFrontend::UI::MainWindow::slot_find(), GpgFrontend::UI::MainWindow::slot_import_key_from_edit(), GpgFrontend::UI::MainWindow::slot_sign(), and GpgFrontend::UI::MainWindow::slot_verify().

## ◆ UnsavedDocuments()

QHash< int, QString > GpgFrontend::UI::TextEdit::UnsavedDocuments | ( |  | ) | const

List of currently unsaved tabs.

Returns
  QHash<int, QString> Hash of tab indexes and title of unsaved tabs.

The documentation for this class was generated from the following files:

- src/ui/widgets/TextEdit.h
- src/ui/widgets/TextEdit.cpp