MyFileNote

Dolphin Service Menus

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net

0
6.4
Description:

First of all i want to thank "Mr.Klijn" who told me the code for this!

I have the idea from the Windows Explorer Shellextension FileNote made by "Moon Software"

What it is:
MyFileNote is a small, single-purpose service menu which will
create a txt-file for a file or directory and opens it in your texteditor (default kwrite).
No need for extra Software or "big" Databases of your files or some other imho overkills if you just want some notes.

It is really helpfull to have more infos on the files on your computer!
I use it very often for description of stuff i download from Websites or projects to-dos etc. .

Example:
you have just downloadet a file example.zip and you may want to remember where you get it.
Rightclick it -> Actions -> MyFileNote
It now opens Kwrite and you can copy-paste the url there.
The txt-file's name is example.zip.txt in the same directory where example.zip is.
If you want to enter additional stuff it is no problem because a existing example.zip.txt will be used so you can just add your text!

Install:
Extract and then:
Just for your User: Copy MyFileNote.desktop to "/home/USERNAME/.kde/share/apps/konqueror/servicemenus/"
For all Users(do as root): Copy MyFileNote.desktop to "/usr/share/apps/konqueror/servicemenus/"

Notes:
If you want to use another editor (I for example prefer Kate)
you have to edit MyFileNote.desktop and replace all "kwrite" with "kate".

Any comments welcome.
Last changelog:

12 years ago

1.0 First Public Release

BorgQueen

12 years ago

Thanks!

Report

penguiniator

12 years ago

I modified the service menu incorporating a couple of suggestions:

[Desktop Entry]
ServiceTypes=all/all
Actions=MyFileNote

[Desktop Action MyFileNote]
Name=MyFileNote
Icon=kwrite
Exec=if ! [ "$EDITOR" = "" ]; then $EDITOR %U.filenote; else kwrite %U.filenote; fi

Report

C

realalienx

12 years ago

This looks nice!
I will most likely take this in the next version so that a user who has set his prefered editor can use this!

I also think about a settings-file where a bash-script could make a notice if the user wants KDialog or a editor.

But lets see :-)

thx all

Report

penguiniator

12 years ago

You could have your service menu check the value of this environment variable and use a default fallback editor such as kwrite. That way those with a set preference will have it honored.

Report

Maxilys

12 years ago

I like the idea but I think it would be better to use KDialog to show a little textbox to enter a note than to use a full text editor.

I also think it wouldn't be such a bad idea to give a distinctive extension to the notes. ("*.filenote" for example.) This way it would be easy to assign an also distinctive icon to them and --most important-- to assign a program to view these notes. Once again, that would be a little script using KDialog to show/edit a note. It would less disruptive than a big text editor with its big window invading your screen just for one or two lines of note.

Report

C

realalienx

12 years ago

Thanks for your Ideas:

The .filenote extension is a nice Idea
and i will think about it.

For the KDialog i don't know - I like the idea of a smaller input window but i use MyFileNote not allone for small urls or some other short Text. I write down entire descriptions of a program for example including hints to install or versions etc. - This way i can search with Kerry or another search programm for it. For that i myself want a good texteditor.

I will look at the response for this app see what other people want.

I think this could be a optional feature. So the user could chose.

Report

Maxilys

12 years ago

I checked KDialog features. I don't know the size of the text you can enter in a text input box but it can be long enough to trigger the use of a scrollbar. Besides, you have the usual keyboard shortcuts to cut/copy/paste. The only problem is that whichever way your format your input, it will turn into a single paragraph. Any way, it works quite nicely. So, here's the script I wrote for my very personal version of MyFileNote:

------------
#! /bin/bash
fullname=$1
if [ "${fullname##*.}" != "filenote" ] ; then
fullname="$fullname.filenote"
fi
if [ -e "$fullname" ] ; then
oldnote=`cat "$fullname"`
fi
shortname="${fullname##*/}"
shortname="${shortname%%.filenote}"
newnote=`kdialog --title "MyFileNote" --textinputbox \
"Note about \"$shortname\":" "$oldnote" 300 200`
if [ "$oldnote" != "$newnote" ] ; then
if [ -z "$newnote" ] ; then
rm "$fullname"
else
echo $newnote > "$fullname"
fi
fi
------------

Do what you want with it. It is made as well to create notes as to view/edit them. And it contains a special feature: When you delete entirely the text of a note, the note itself is deleted from your disk. Very useful when you view an old note that you don't need any more.

Report

miguel2

12 years ago

This is interesting but how to use the script with the servicemenu?

Report

Maxilys

12 years ago

First, you save my script in your $PATH without forgetting to set the executable flag. You create the new filetype with the "filenote.desktop" file I also gave. Then you create a new text file or you re-use an existing one. All that matters is that it has the extension ".filenote". (The content is irrelevant.) Finally you associate the ".filenote" files with the script. This step enables you to view/edit/delete file notes.

To be able to create filenotes, you download MyFileNote and you edit the "Exec=" line so that it says:

Exec=/path/to/my/script %U

(Just %U, that's intentional.) You save it and you install it as RealAlienX explains. That's it.

Just to make everything look a little better, you can also edit the "Icon=" line so that it says:

Icon=filetypes

(I find this icon really nice... and appropriate.)

If you have more questions, you know where to find me. ;-)

Report

miguel2

12 years ago

Thanks for your help! This is great enhancement.

To enhance it some more I have a couple of suggestions:

1. Configure Exec in filetype
Is it possible to associate the script in the the filenote filetype directly? So The step to associate the filetype with the script would be obsolete.

2. Icon
The filetypes icon is in fact very appropriate. It would be nice if the starticon and the windowicon also would be 'filetypes'.

3. Linebreaks
You write that paragraphs aren't possible. If think the problem is the conversion of the control characters for linebreaks and paragraphs. If you modify the text of a filenote in a editor an then open it with kdialog you have linebreaks. When you modify the text in kdialog the linebreaks are gone. So the shellscript should convert linebreaks from kdialog into control characters.

4. Edit and delete button
A nice feature and an argument to merge your solution with the original one would be a button 'Edit with Editor' for advanced edit. An other button could be 'delete' to delete the note directly. You'll find a tutorial here: http://developer.kde.org/documentation/tutorials/kdialog/t1.html

5. Installer
Last but not least: With an installer it isn't anymore necessary to give further instructions ;-)

Report

miguel2

12 years ago

1. I hope RealAlienX will read this thread and incoorperate some changes.

2. Ok the starticon works this way. Any idea about the windowicon?

3. Ok now its fine.

4. I didn't want to offend you with the link to the tutorial.
I agree with you that Kdialog is more than sufficient. I though on RealAlienXs arguments concering an editor - thats why I made this suggestion.

5. See 1.

So RealAlienX please update ;-)

Report

Maxilys

12 years ago

1. I was only proposing ideas. I can't re-built RealAlienX's archive.

2. For that, you must add the script somewhere in KMenu and give it the appropriate icon.

3. Forget what I said. It was my mistake. You must add quotes to the "echo" line so that it looks like:

echo "$newnote" > "$fullname"

4. I agree with the delete button. It would make things easier. As for using a regular editor: No. I use KDialog because I found that an editor was too much to write tiny notes. Besides, the text editor of KDialog supports everthing: copy/cut/paste through the regular shortcuts, drag and drop. What else do you want? A bigger window? Change the script to have it. ;-) And thanks for the tutorial but that won't be needed. LOL

5. Sure! An installer would be nice but I just don't want to rip RealAlienX's idea. That's why everything comes as bits and pieces.

Report

Maxilys

12 years ago

To create a new file type, create the file "$KDEDIR/share/mimelnk/text/filenote.desktop" as root. (AFAIK, you can't have a personal file type.) then paste into it the following:

------------
[Desktop Entry]
Comment=Note about a file
Comment[fr]=Note sur un fichier
Encoding=UTF-8
Hidden=false
Icon=filetypes
MimeType=text/filenote
Patterns=*.filenote
Type=MimeType
X-KDE-AutoEmbed=false

[Property::X-KDE-NativeExtension]
Type=QString
Value=.filenote

[Property::X-KDE-text]
Type=bool
Value=true
------------

This separates the ".filenote" from the simple texts and assign a nice icon to them. This also enables you to assign an app or a script to open them. Don't forget to add a comment in your language... If you want.

Report

freefred

12 years ago

yes.
I like the servicemenu, very useful.

But I agree totally with these thoughts,
a dialog instead of an editor and a different file extension would make MyFileNote almost perfect.

thx

bye

Report

janet

12 years ago

Thanks a lot - I was just about to writing something like that myself :).

Report

12 years ago

1.0 First Public Release

12345678910
product-maker Count:13 Rating: 6.38
File (click to download) Version Description Downloads Date Filesize DL OCS-Install
Pling
*Needs ocs-url or ocs-store to install things
Details
license
version
1.0
updated Mar 12 2007
added Mar 12 2007
downloads today
0
page views today 1
System Tags addon
+