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

kio/kfile

  • kio
  • kfile
kfilespeedbar.cpp
1 /* This file is part of the KDE libraries
2  Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org>
3 
4  library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation, version 2.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 #include "kfilespeedbar.h"
20 #include "config-kfile.h"
21 
22 #include <tqdir.h>
23 #include <tqfile.h>
24 #include <tqtextcodec.h>
25 #include <tqtextstream.h>
26 
27 #include <kconfig.h>
28 #include <kglobal.h>
29 #include <kglobalsettings.h>
30 #include <klocale.h>
31 #include <kprotocolinfo.h>
32 #include <kstandarddirs.h>
33 #include <kurl.h>
34 
35 KFileSpeedBar::KFileSpeedBar( TQWidget *parent, const char *name )
36  : KURLBar( true, parent, name )
37 {
38  KConfig *config = KGlobal::config();
39  KConfigGroupSaver cs( config, ConfigGroup );
40  m_initializeSpeedbar = config->readBoolEntry( "Set speedbar defaults",
41  true );
42  setIconSize(KIcon::SizeSmallMedium);
43  readConfig( KGlobal::config(), "KFileDialog Speedbar" );
44 
45  if ( m_initializeSpeedbar )
46  {
47  insertItem(TQDir::homeDirPath(), i18n("Home Folder"), false, "folder_home");
48  insertItem(KGlobalSettings::desktopPath(), i18n("Desktop"), false, "desktop");
49  insertItem(KGlobalSettings::documentPath(), i18n("Documents"), false, "folder_wordprocessing");
50  insertItem(KGlobalSettings::downloadPath(), i18n( "Downloads" ), false, "folder_html");
51  insertItem(KGlobalSettings::musicPath(), i18n( "Music" ), false, "folder_sound");
52  insertItem(KGlobalSettings::picturesPath(), i18n( "Pictures" ), false, "folder_image");
53  insertItem(KGlobalSettings::publicSharePath(), i18n( "Public" ), false, "folder_open");
54  insertItem(KGlobalSettings::templatesPath(), i18n( "Templates" ), false, "folder_grey");
55  insertItem(KGlobalSettings::videosPath(), i18n( "Videos" ), false, "folder_video");
56 
57  KURL u = "media:/";
58  if (KProtocolInfo::isKnownProtocol(u))
59  {
60  insertItem(u, i18n("Storage Media"), false, KProtocolInfo::icon("media"));
61  }
62 
63  u = "remote:/";
64  if (KProtocolInfo::isKnownProtocol(u))
65  {
66  insertItem(u, i18n("Network Folders"), false, KProtocolInfo::icon("remote"));
67  }
68  }
69 }
70 
71 KFileSpeedBar::~KFileSpeedBar()
72 {
73 }
74 
75 void KFileSpeedBar::save( KConfig *config )
76 {
77  if ( m_initializeSpeedbar && isModified() )
78  {
79  KConfigGroup conf( config, ConfigGroup );
80  // write to kdeglobals
81  conf.writeEntry( "Set speedbar defaults", false, true, true );
82  }
83 
84  writeConfig( config, "KFileDialog Speedbar" );
85 }
86 
87 TQSize KFileSpeedBar::sizeHint() const
88 {
89  TQSize sizeHint = KURLBar::sizeHint();
90  int ems = fontMetrics().width("mmmmmmmmmmmm");
91  if (sizeHint.width() < ems)
92  {
93  sizeHint.setWidth(ems);
94  }
95  return sizeHint;
96 }
97 
98 #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.8.1.2
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |