• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdefile
 

tdeio/tdefile

kpreviewprops.cpp
00001 /* This file is part of the KDE libraries
00002     Copyright (C) 2005 Stephan Binner <binner@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License version 2 as published by the Free Software Foundation.
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 
00020 #include "kpreviewprops.h"
00021 
00022 #include <tqlayout.h>
00023 
00024 #include <tdefilemetapreview.h>
00025 #include <tdeglobalsettings.h>
00026 #include <tdelocale.h>
00027 
00028 class KPreviewPropsPlugin::KPreviewPropsPluginPrivate
00029 {
00030 public:
00031     KPreviewPropsPluginPrivate()  {}
00032     ~KPreviewPropsPluginPrivate() {}
00033 };
00034 
00035 KPreviewPropsPlugin::KPreviewPropsPlugin(KPropertiesDialog* props)
00036   : KPropsDlgPlugin(props)
00037 {
00038     d = new KPreviewPropsPluginPrivate;
00039 
00040     if (properties->items().count()>1)
00041         return;
00042 
00043     createLayout();
00044 }
00045 
00046 void KPreviewPropsPlugin::createLayout()
00047 {
00048     // let the dialog create the page frame
00049     TQFrame* topframe = properties->addPage(i18n("P&review"));
00050     topframe->setFrameStyle(TQFrame::NoFrame);
00051 
00052     TQVBoxLayout* tmp = new TQVBoxLayout(topframe, 0, 0);
00053 
00054     preview = new KFileMetaPreview(topframe);
00055 
00056     tmp->addWidget(preview) ;
00057     connect( properties, TQT_SIGNAL( aboutToShowPage( TQWidget * ) ), TQT_SLOT( aboutToShowPage( TQWidget* ) ) );
00058 }
00059 
00060 KPreviewPropsPlugin::~KPreviewPropsPlugin()
00061 {
00062     delete d;
00063 }
00064 
00065 bool KPreviewPropsPlugin::supports( KFileItemList _items )
00066 {
00067     if ( _items.count() != 1)
00068         return false;
00069     if( !TDEGlobalSettings::showFilePreview(_items.first()->url()))
00070         return false;
00071     KMimeType::Ptr mt = KMimeType::findByURL( _items.first()->url() );
00072     if ( mt->inherits("inode/directory") || mt->name() == "application/octet-stream" )
00073         return false;
00074     
00075     //TODO Copy everything of KFileMetaPreview::previewProviderFor() ?
00076 
00077     return true;
00078 }
00079 
00080 void KPreviewPropsPlugin::aboutToShowPage( TQWidget* widget )
00081 {
00082     if ( TQT_TQOBJECT(widget) != TQT_TQOBJECT(preview->parent()) )
00083         return;
00084 
00085     disconnect( properties, TQT_SIGNAL( aboutToShowPage( TQWidget * ) ), this, TQT_SLOT( aboutToShowPage( TQWidget* ) ) );
00086     preview->showPreview(properties->item()->url());
00087 }
00088 
00089 #include "kpreviewprops.moc"

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdefile by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.