Results 1 to 5 of 5

Thread: Add document model to the right click option "create new"?

  1. #1
    colombird NNTP User

    Default Add document model to the right click option "create new"?

    Hi I knew in ubuntu you had to put the models you wanted to add as a prompt when trying to create a new file(eg.txt file,ecc) in a certain folder and that was all!
    Does anybody knows how is it with opensuse?
    thanks

  2. #2

    Default Re: Add document model to the right click option "create new

    If you are using Gnome on openSUSE, then create a directory called Templates in your home. Put any document template you want in this directory and it will show up in the create new menu.

  3. #3
    colombird NNTP User

    Default Re: Add document model to the right click option "create new

    Great!...Notwithstanding my terrible message! thanks very much!

  4. #4
    MiloshForman NNTP User

    Default Re: Add document model to the right click option "create new

    Implemented to OpenSuse 11.1
    Crosspost from TechKnack: Add entries to Konqueror's "Create new" menu (Great thanks to author!)

    Add entries to Konqueror’s "Create new" menu
    ===============================
    This has been a point of frustration for me since I first wanted to add “Create new .doc file” to Konqueror’s context menu. To the best of my knowledge, there is no GUI method of adding filetypes to Konqueror’s “Create new” menu, and there is little or no online documentation that details how to go about adding filetypes, or even how the system works. Grr.

    The good news is that it is possible, even easy, to add filetypes to Konqueror’s “Create new” menu. Best of all, it only requires adding a couple of files to an existing directory.

    The entries in the “Create new” menu are actually called “templates”. Which makes sense, since the newly created file is nothing more than a blank template to which you add content. The files that make up the menu entries are .desktop files located at /usr/share/templates/. The .desktop files point to template files located at /usr/share/templates/.sources, a hidden directory inside the templates directory. For my example, I’m going to add a .doc file template, since it is so often used in school. The basic idea can be applied to any file type, though.

    First, open the program which can create the file you want to add (in this case, OpenOffice Writer). Create a new, blank document, and “Save as” the appropriate file (be sure to choose the .doc extension, not .odf) in an easily-accessible place (meaning user-accessible, a good place would be your desktop). I believe the name of the template file is used as the default name of the new document, though it will ask you for a filename before creating the file; I simply named my file “MS Word 2003 Doc.doc”. After the template is created, fire up a command line and use
    sudo mv "~/Desktop/MS Word 2003 Doc.doc" /usr/share/templates/.sources/

    to move the template into its new permanent residence. Now go up a level to /usr/share/templates/. You will need root privileges of some sort (either a konqueror instance running under root, or sudoing at the command line). Copy one of the existing .desktop files (I recommend a filetype-specific file, such as the HTMLFile.desktop or TextFile.desktop files) to something like MSDoc.desktop. Open the new file for editing with root privileges (from a command line,
    kdesu kate /usr/share/templates/MSDoc.desktop &

    ). Now you can either delete all the nonessential lines of foreign language code (keeping one line of each of Encoding, Name, Comment, Type, URL, and Icon instructions), and edit the remainder to fit your preferences, or you can copy my file’s contents and paste it into your file:

    [Desktop Entry]
    Encoding=UTF-8
    Name=MS Word 2003 Document…
    Comment=Enter Document name:
    Type=Link
    URL=.source/MS Word 2003 Doc.doc
    Icon=document



    I leave the Encoding line as-is from the HTMLFile.desktop file I copied it from. Name is the text that will show up in the menu. Comment is the text that will prompt for the new file’s name. Type=Link specifies that this file is a link to another file (leave as is). URL points to the template file (which resides in the .source directory). Icon specifies what icon will be used in to identify the file type in the “Create new” menu. For Icon, “document” gives the file the icon associated with document files. The Icon for TextFile.desktop is “txt”, and for HTMLFile.desktop, “html”. I don’t know how to go about finding the correct word form other filetypes, other than experimentation. A couple that seem to work for me include “spreadsheet” for a spreadsheet icon, “openofficeorg23-oasis-presentation” for the Oasis icon for OO Impress. One thing to try would be to open KControl, go to KDE Components -> File Associations, click on any mime type, and click the filetype’s icon on the right. You should be taken to the Icon chooser. Select “Mime types” from the dropdown, and search for portions of keywords that match the icon you’re looking for. Do not click any icons. To get the name of an icon, hover over the icon, and the chooser should give you a tooltip with the icon’s name. Use that name in the .desktop file, and it should present that icon in the “Create new” menu.

    If you followed everything correctly, you should now have an entry in Konqueror’s “Create new” menu for creating a new .doc file. To recap:

    Create a blank template file
    Move the template file to /usr/share/templates/.source/
    Create a .desktop file in /usr/share/templates/ with the appropriate values


    Enjoy your new file-creation capabilities!

    To extend functionality, you can, obviously, add template content to your template files. For example, if you develop websites and you’re tired of always looking up the correct doctype declaration, you can build an html template file, complete with doctype, and simply create it from the Konqueror context menu. In fact, the existing HTMLFile.html file in my .source directory already has the basic structure of a standard web page. Of course, this isjust an example, and could be applied to other filetypes.
    ===============================
    Addon from me:
    In OpenSuse 11.1
    KDE 4 templates here - /usr/share/kde4/templates
    KDE 3 templates here - /opt/kde3/share/templates

    ---
    Enjoy!

  5. #5
    MiloshForman NNTP User

    Default Re: Add document model to the right click option "create new"?


    Implemented to OpenSuse 11.1
    Crosspost from 'TechKnack: Add entries to Konqueror's \"Create new\"
    menu' (http://tinyurl.com/9wvb5w) (Great thanks to author!)

    ADD ENTRIES TO KONQUEROR’S \"CREATE NEW\" MENU
    ===============================
    This has been a point of frustration for me since I first wanted to add
    “Create new .doc file” to Konqueror’s context menu. To
    the best of my knowledge, there is no GUI method of adding filetypes to
    Konqueror’s “Create new” menu, and there is little or
    no online documentation that details how to go about adding filetypes,
    or even how the system works. Grr.

    The good news is that it is possible, even easy, to add filetypes to
    Konqueror’s “Create new” menu. Best of all, it only
    requires adding a couple of files to an existing directory.

    The entries in the “Create new” menu are actually called
    “templates”. Which makes sense, since the newly created file
    is nothing more than a blank template to which you add content. The
    files that make up the menu entries are .desktop files located at
    /usr/share/templates/. The .desktop files point to template files
    located at /usr/share/templates/.sources, a hidden directory inside the
    templates directory. For my example, I’m going to add a .doc file
    template, since it is so often used in school. The basic idea can be
    applied to any file type, though.

    First, open the program which can create the file you want to add (in
    this case, OpenOffice Writer). Create a new, blank document, and
    “Save as” the appropriate file (be sure to choose the .doc
    extension, not .odf) in an easily-accessible place (meaning
    user-accessible, a good place would be your desktop). I believe the name
    of the template file is used as the default name of the new document,
    though it will ask you for a filename before creating the file; I simply
    named my file “MS Word 2003 Doc.doc”. After the template is
    created, fire up a command line and use
    sudo mv "~/Desktop/MS Word 2003 Doc.doc"
    /usr/share/templates/.sources/

    to move the template into its new permanent residence. Now go up a
    level to /usr/share/templates/. You will need root privileges of some
    sort (either a konqueror instance running under root, or sudoing at the
    command line). Copy one of the existing .desktop files (I recommend a
    filetype-specific file, such as the HTMLFile.desktop or TextFile.desktop
    files) to something like MSDoc.desktop. Open the new file for editing
    with root privileges (from a command line,
    kdesu kate /usr/share/templates/MSDoc.desktop &

    ). Now you can either delete all the nonessential lines of foreign
    language code (keeping one line of each of Encoding, Name, Comment,
    Type, URL, and Icon instructions), and edit the remainder to fit your
    preferences, or you can copy my file’s contents and paste it into
    your file:

    [DESKTOP ENTRY]
    ENCODING=UTF-8
    NAME=MS WORD 2003 DOCUMENT…
    COMMENT=ENTER DOCUMENT NAME:
    TYPE=LINK
    URL=.SOURCE/MS WORD 2003 DOC.DOC
    ICON=DOCUMENT


    I leave the Encoding line as-is from the HTMLFile.desktop file I copied
    it from. Name is the text that will show up in the menu. Comment is the
    text that will prompt for the new file’s name. Type=Link specifies
    that this file is a link to another file (leave as is). URL points to
    the template file (which resides in the .source directory). Icon
    specifies what icon will be used in to identify the file type in the
    “Create new” menu. For Icon, “document” gives
    the file the icon associated with document files. The Icon for
    TextFile.desktop is “txt”, and for HTMLFile.desktop,
    “html”. I don’t know how to go about finding the
    correct word form other filetypes, other than experimentation. A couple
    that seem to work for me include “spreadsheet” for a
    spreadsheet icon, “openofficeorg23-oasis-presentation” for
    the Oasis icon for OO Impress. One thing to try would be to open
    KControl, go to KDE Components -> File Associations, click on any mime
    type, and click the filetype’s icon on the right. You should be
    taken to the Icon chooser. Select “Mime types” from the
    dropdown, and search for portions of keywords that match the icon
    you’re looking for. Do not click any icons. To get the name of an
    icon, hover over the icon, and the chooser should give you a tooltip
    with the icon’s name. Use that name in the .desktop file, and it
    should present that icon in the “Create new” menu.

    If you followed everything correctly, you should now have an entry in
    Konqueror’s “Create new” menu for creating a new .doc
    file. To recap:

    CREATE A BLANK TEMPLATE FILE
    MOVE THE TEMPLATE FILE TO /USR/SHARE/TEMPLATES/.SOURCE/
    CREATE A .DESKTOP FILE IN /USR/SHARE/TEMPLATES/ WITH THE APPROPRIATE
    VALUES

    Enjoy your new file-creation capabilities!

    To extend functionality, you can, obviously, add template content to
    your template files. For example, if you develop websites and
    you’re tired of always looking up the correct doctype declaration,
    you can build an html template file, complete with doctype, and simply
    create it from the Konqueror context menu. In fact, the existing
    HTMLFile.html file in my .source directory already has the basic
    structure of a standard web page. Of course, this isjust an example, and
    could be applied to other filetypes.
    ===============================
    ADDON FROM ME:
    IN OPENSUSE 11.1
    KDE 4 TEMPLATES HERE - /USR/SHARE/KDE4/TEMPLATES
    KDE 3 TEMPLATES HERE - /OPT/KDE3/SHARE/TEMPLATES
    ---
    Enjoy!


    --
    MiloshForman
    ------------------------------------------------------------------------
    MiloshForman's Profile: http://forums.opensuse.org/member.php?userid=20452
    View this thread: http://forums.opensuse.org/showthread.php?t=393573


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •