Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Option to show full file path in statusbar #3023

Open
justinbeaty opened this issue May 7, 2024 · 3 comments
Open

[FEATURE] Option to show full file path in statusbar #3023

justinbeaty opened this issue May 7, 2024 · 3 comments
Labels

Comments

@justinbeaty
Copy link

justinbeaty commented May 7, 2024

Is your feature request related to a problem? Please describe.

I use subfolders and it would be helpful to see the full file path of the note I currently have open. Sometimes I may have notes with the same filename in multiple folders.

Describe the solution you'd like

It would be beneficial to see the full file path in the status bar, or even the relative path to the notes root folder. Something like this:

image

I created a patch, but it's only a proof of concept.

diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index e790a37b3..0728875dd 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -3068,6 +3068,15 @@ void MainWindow::setupStatusBarWidgets() {
 
     ui->statusBar->addPermanentWidget(_readOnlyButton);
 
+    /*
+     * setup of file path label
+     */
+    _noteFilePathLabel = new QLabel(this);
+    _noteFilePathLabel->setText(QStringLiteral(""));
+    _noteFilePathLabel->setToolTip(tr("Full file path"));
+
+    ui->statusBar->addWidget(_noteFilePathLabel);
+
     /*
      * setup of line number label
      */
@@ -3774,6 +3783,9 @@ void MainWindow::setCurrentNote(Note note, bool updateNoteText, bool updateSelec
     // call a script hook that a new note was opened
     ScriptingService::instance()->callHandleNoteOpenedHook(&currentNote);
 
+    // update file path label
+    _noteFilePathLabel->setText(currentNote.fullNoteFilePath().toLatin1().data());
+
     //    putenv(QString("QOWNNOTES_CURRENT_NOTE_PATH=" + currentNote
     //            .fullNoteFilePath()).toLatin1().data());
     //    setenv("QOWNNOTES_CURRENT_NOTE_PATH",
diff --git a/src/mainwindow.h b/src/mainwindow.h
index f63f4fe63..e70b1ca59 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -755,6 +755,7 @@ class MainWindow : public QMainWindow {
     NoteHistory noteHistory;
     QHash<int, NoteHistoryItem> noteBookmarks;
     QPushButton *_updateAvailableButton;
+    QLabel *_noteFilePathLabel;
     QLabel *_noteEditLineNumberLabel;
     QPushButton *_readOnlyButton;
     QPushButton *_leaveDistractionFreeModeButton;

Describe alternatives you've considered

Unsure of any alternatives.

Additional context

This should probably be behind a setting option. Also, if the setting is off, then the label shouldn't show in the status bar else there's an empty spot you can hover over and see the tooltip. Thus, I think changing this option may require QOwnNotes to reload so we can reinitialize MainWindow::setupStatusBarWidgets.

Output from the debug section in the settings dialog

Expand
@justinbeaty justinbeaty changed the title [FEATURE] [FEATURE] Option to show full file path in statusbar May 7, 2024
@pbek
Copy link
Owner

pbek commented May 7, 2024

Currently, the left side is used to actually show when something is happening, e.g. notes got stored. 🤔

Normally, I'd say, you could implement that yourself with the help of https://www.qownnotes.org/scripting/methods-and-objects.html#registering-a-label.

But I'd even would look at a pull request in QOwnNotes, if you would want to work on that.

Some things that come to mind:

  • Resetting of that label when no note or a new note is selected would need to work better
  • There needs to be a new checkbox in the Editor settings to turn that feature on
  • It would maybe even nice to copy the path to the clipboard when double-clicking the note path
    • This action should then also be shown as status text for a status text

@pbek pbek added Type: Feature adds functionality Importance: Low and removed Type: Support labels May 7, 2024
@justinbeaty
Copy link
Author

Currently, the left side is used to actually show when something is happening, e.g. notes got stored. 🤔

Qt actually handles this by using addWidget instead of addPermanentWidget. I tested it by reloading the scripting engine via the menu. Usage of showStatusBarMessage will show the message for the timeout specified, and then it reverts back to displaying the file path.

But I'd even would look at a pull request in QOwnNotes, if you would want to work on that.

Some things that come to mind:

  • Resetting of that label when no note or a new note is selected would need to work better

  • There needs to be a new checkbox in the Editor settings to turn that feature on

  • It would maybe even nice to copy the path to the clipboard when double-clicking the note path

    • This action should then also be shown as status text for a status text

I'll work on a PR with these ideas in mind.

@pbek
Copy link
Owner

pbek commented May 8, 2024

Great! 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants