mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
kio: format and indent
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
288498df73
commit
ff202c6de0
3 changed files with 42 additions and 35 deletions
|
@ -506,10 +506,10 @@ const QString KMainWindow::classNameOfToplevel( int number )
|
|||
s.prepend( QLatin1String("WindowProperties") );
|
||||
|
||||
KConfigGroup group( config, s );
|
||||
if ( !group.hasKey( "ClassName" ) )
|
||||
if ( !group.hasKey( "ClassName" ) ) {
|
||||
return QString();
|
||||
else
|
||||
return group.readEntry( "ClassName" );
|
||||
}
|
||||
return group.readEntry( "ClassName" );
|
||||
}
|
||||
|
||||
bool KMainWindow::restore( int number, bool show )
|
||||
|
|
|
@ -33,13 +33,13 @@ public:
|
|||
~KPreviewPropsPluginPrivate() {}
|
||||
};
|
||||
|
||||
KPreviewPropsPlugin::KPreviewPropsPlugin(KPropertiesDialog* props)
|
||||
: KPropertiesDialogPlugin(props),d(new KPreviewPropsPluginPrivate)
|
||||
KPreviewPropsPlugin::KPreviewPropsPlugin(KPropertiesDialog *props)
|
||||
: KPropertiesDialogPlugin(props),
|
||||
d(new KPreviewPropsPluginPrivate)
|
||||
{
|
||||
|
||||
if (properties->items().count()>1)
|
||||
if (properties->items().count() > 1) {
|
||||
return;
|
||||
|
||||
}
|
||||
createLayout();
|
||||
}
|
||||
|
||||
|
@ -55,8 +55,11 @@ void KPreviewPropsPlugin::createLayout()
|
|||
|
||||
preview = new KImageFilePreview(topframe);
|
||||
|
||||
tmp->addWidget(preview) ;
|
||||
connect( properties, SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)), SLOT(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)) );
|
||||
tmp->addWidget(preview);
|
||||
connect(
|
||||
properties, SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)),
|
||||
this, SLOT(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*))
|
||||
);
|
||||
}
|
||||
|
||||
KPreviewPropsPlugin::~KPreviewPropsPlugin()
|
||||
|
@ -64,14 +67,16 @@ KPreviewPropsPlugin::~KPreviewPropsPlugin()
|
|||
delete d;
|
||||
}
|
||||
|
||||
bool KPreviewPropsPlugin::supports( const KFileItemList &_items )
|
||||
bool KPreviewPropsPlugin::supports(const KFileItemList &items)
|
||||
{
|
||||
if ( _items.count() != 1 )
|
||||
if (items.count() != 1) {
|
||||
return false;
|
||||
bool metaDataEnabled = KGlobalSettings::showFilePreview(_items.first().url());
|
||||
if (!metaDataEnabled)
|
||||
}
|
||||
const bool metaDataEnabled = KGlobalSettings::showFilePreview(items.first().url());
|
||||
if (!metaDataEnabled) {
|
||||
return false;
|
||||
const KMimeType::Ptr itemMime = _items.first().mimeTypePtr();
|
||||
}
|
||||
const KMimeType::Ptr itemMime = items.first().mimeTypePtr();
|
||||
foreach(const QString &it, KIO::PreviewJob::supportedMimeTypes()) {
|
||||
if (itemMime->is(it)) {
|
||||
return true;
|
||||
|
@ -91,12 +96,16 @@ bool KPreviewPropsPlugin::supports( const KFileItemList &_items )
|
|||
return false;
|
||||
}
|
||||
|
||||
void KPreviewPropsPlugin::currentPageChanged( KPageWidgetItem *current, KPageWidgetItem * )
|
||||
void KPreviewPropsPlugin::currentPageChanged(KPageWidgetItem *current, KPageWidgetItem *)
|
||||
{
|
||||
if ( current->widget() != preview->parent() )
|
||||
if (current->widget() != preview->parent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
disconnect( properties, SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)), this, SLOT(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)) );
|
||||
disconnect(
|
||||
properties, SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)),
|
||||
this, SLOT(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*))
|
||||
);
|
||||
preview->showPreview(properties->item().url());
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
*/
|
||||
|
||||
#ifndef __KPREVIEWPROPS_H__
|
||||
#define __KPREVIEWPROPS_H__
|
||||
#ifndef KPREVIEWPROPS_H
|
||||
#define KPREVIEWPROPS_H
|
||||
|
||||
#include <kpropertiesdialog.h>
|
||||
|
||||
|
@ -30,27 +30,25 @@ class KImageFilePreview;
|
|||
*/
|
||||
class KIO_EXPORT KPreviewPropsPlugin : public KPropertiesDialogPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
KPreviewPropsPlugin( KPropertiesDialog *props);
|
||||
virtual ~KPreviewPropsPlugin();
|
||||
|
||||
KPreviewPropsPlugin( KPropertiesDialog *_props );
|
||||
virtual ~KPreviewPropsPlugin();
|
||||
|
||||
/**
|
||||
* Tests whether a preview for the first item should be shown
|
||||
*/
|
||||
static bool supports( const KFileItemList& _items );
|
||||
/**
|
||||
* Tests whether a preview for the first item should be shown
|
||||
*/
|
||||
static bool supports(const KFileItemList &items);
|
||||
|
||||
private Q_SLOTS:
|
||||
void currentPageChanged( KPageWidgetItem *, KPageWidgetItem * );
|
||||
void currentPageChanged(KPageWidgetItem *, KPageWidgetItem *);
|
||||
|
||||
private:
|
||||
KImageFilePreview* preview;
|
||||
void createLayout();
|
||||
KImageFilePreview* preview;
|
||||
void createLayout();
|
||||
|
||||
class KPreviewPropsPluginPrivate;
|
||||
KPreviewPropsPluginPrivate* const d;
|
||||
class KPreviewPropsPluginPrivate;
|
||||
KPreviewPropsPluginPrivate* const d;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // KPREVIEWPROPS_H
|
||||
|
|
Loading…
Add table
Reference in a new issue