
MyFileNote
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
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.
14 years ago
1.0 First Public Release
14 years ago
1.0 First Public Release
BorgQueen
14 years ago
Report
penguiniator
14 years ago
[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
realalienx
14 years ago
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
14 years ago
Report
Maxilys
14 years ago
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
realalienx
14 years ago
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
14 years ago
------------
#! /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
14 years ago
Report
Maxilys
14 years ago
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
14 years ago
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
13 years ago
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
13 years ago
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
14 years ago
------------
[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
14 years ago
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
14 years ago
Report