• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kio/kfile
 

kio/kfile

kfilespeedbar.cpp
00001 /* This file is part of the KDE libraries
00002     Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org>
00003 
00004     library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation, version 2.
00007 
00008     This library is distributed in the hope that it will be useful,
00009     but WITHOUT ANY WARRANTY; without even the implied warranty of
00010     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011     Library General Public License for more details.
00012 
00013     You should have received a copy of the GNU Library General Public License
00014     along with this library; see the file COPYING.LIB.  If not, write to
00015     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016     Boston, MA 02110-1301, USA.
00017 */
00018 
00019 #include "kfilespeedbar.h"
00020 #include "config-kfile.h"
00021 
00022 #include <tqdir.h>
00023 #include <tqfile.h>
00024 #include <tqtextcodec.h>
00025 #include <tqtextstream.h>
00026 
00027 #include <kconfig.h>
00028 #include <kglobal.h>
00029 #include <kglobalsettings.h>
00030 #include <klocale.h>
00031 #include <kprotocolinfo.h>
00032 #include <kstandarddirs.h>
00033 #include <kurl.h>
00034 
00035 KFileSpeedBar::KFileSpeedBar( TQWidget *parent, const char *name )
00036     : KURLBar( true, parent, name )
00037 {
00038     KConfig *config = KGlobal::config();
00039     KConfigGroupSaver cs( config, ConfigGroup );
00040     m_initializeSpeedbar = config->readBoolEntry( "Set speedbar defaults",
00041                                                    true );
00042     setIconSize(KIcon::SizeSmallMedium);
00043     readConfig( KGlobal::config(), "KFileDialog Speedbar" );
00044 
00045     if ( m_initializeSpeedbar )
00046     {
00047         insertItem(TQDir::homeDirPath(), i18n("Home Folder"), false, "folder_home");
00048         insertItem(KGlobalSettings::desktopPath(), i18n("Desktop"), false, "desktop");
00049         insertItem(KGlobalSettings::documentPath(), i18n("Documents"), false, "folder_wordprocessing");
00050         insertItem(KGlobalSettings::downloadPath(), i18n( "Downloads" ), false, "folder_html");
00051         insertItem(KGlobalSettings::musicPath(), i18n( "Music" ), false, "folder_sound");
00052         insertItem(KGlobalSettings::picturesPath(), i18n( "Pictures" ), false, "folder_image");
00053         insertItem(KGlobalSettings::publicSharePath(), i18n( "Public" ), false, "folder_open");
00054         insertItem(KGlobalSettings::templatesPath(), i18n( "Templates" ), false, "folder_grey");
00055         insertItem(KGlobalSettings::videosPath(), i18n( "Videos" ), false, "folder_video");
00056 
00057         KURL u = "media:/";
00058         if (KProtocolInfo::isKnownProtocol(u))
00059         {
00060             insertItem(u, i18n("Storage Media"), false, KProtocolInfo::icon("media"));
00061         }
00062 
00063         u = "remote:/";
00064         if (KProtocolInfo::isKnownProtocol(u))
00065         {
00066             insertItem(u, i18n("Network Folders"), false, KProtocolInfo::icon("remote"));
00067         }
00068     }
00069 }
00070 
00071 KFileSpeedBar::~KFileSpeedBar()
00072 {
00073 }
00074 
00075 void KFileSpeedBar::save( KConfig *config )
00076 {
00077     if ( m_initializeSpeedbar && isModified() )
00078     {
00079         KConfigGroup conf( config, ConfigGroup );
00080         // write to kdeglobals
00081         conf.writeEntry( "Set speedbar defaults", false, true, true );
00082     }
00083 
00084     writeConfig( config, "KFileDialog Speedbar" );
00085 }
00086 
00087 TQSize KFileSpeedBar::sizeHint() const
00088 {
00089     TQSize sizeHint = KURLBar::sizeHint();
00090     int ems = fontMetrics().width("mmmmmmmmmmmm");
00091     if (sizeHint.width() < ems)
00092     {
00093         sizeHint.setWidth(ems);
00094     }
00095     return sizeHint;
00096 }
00097 
00098 #include "kfilespeedbar.moc"

kio/kfile

Skip menu "kio/kfile"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kio/kfile

Skip menu "kio/kfile"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kio/kfile by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |