mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-25 02:45:38 +00:00
make the iconloader in GuiUtils a stack
Fixes problems when the same program uses more than one okular part at once BUGS: 231123 svn path=/trunk/KDE/kdegraphics/okular/; revision=1104494
This commit is contained in:
parent
a212da143a
commit
e90fa31bf9
3
part.cpp
3
part.cpp
|
@ -256,7 +256,7 @@ m_cliPresentation(false), m_embedMode(detectEmbedMode(parentWidget, parent, args
|
|||
// we need an instance
|
||||
setComponentData(okularPartFactory::componentData());
|
||||
|
||||
GuiUtils::setIconLoader( iconLoader() );
|
||||
GuiUtils::addIconLoader( iconLoader() );
|
||||
|
||||
m_sidebar = new Sidebar( parentWidget );
|
||||
setWidget( m_sidebar );
|
||||
|
@ -623,6 +623,7 @@ m_cliPresentation(false), m_embedMode(detectEmbedMode(parentWidget, parent, args
|
|||
|
||||
Part::~Part()
|
||||
{
|
||||
GuiUtils::removeIconLoader( iconLoader() );
|
||||
m_document->removeObserver( this );
|
||||
|
||||
if ( m_document->isOpened() )
|
||||
|
|
|
@ -29,13 +29,12 @@
|
|||
struct GuiUtilsHelper
|
||||
{
|
||||
GuiUtilsHelper()
|
||||
: il( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
QSvgRenderer* svgStamps();
|
||||
|
||||
KIconLoader * il;
|
||||
QList<KIconLoader *> il;
|
||||
std::auto_ptr< QSvgRenderer > svgStampFile;
|
||||
};
|
||||
|
||||
|
@ -187,14 +186,19 @@ QPixmap loadStamp( const QString& _name, const QSize& size, int iconSize )
|
|||
return pixmap;
|
||||
}
|
||||
|
||||
void setIconLoader( KIconLoader * loader )
|
||||
void addIconLoader( KIconLoader * loader )
|
||||
{
|
||||
s_data->il = loader;
|
||||
s_data->il.append( loader );
|
||||
}
|
||||
|
||||
void removeIconLoader( KIconLoader * loader )
|
||||
{
|
||||
s_data->il.removeAll( loader );
|
||||
}
|
||||
|
||||
KIconLoader* iconLoader()
|
||||
{
|
||||
return s_data->il ? s_data->il : KIconLoader::global();
|
||||
return s_data->il.isEmpty() ? KIconLoader::global() : s_data->il.back();
|
||||
}
|
||||
|
||||
void saveEmbeddedFile( Okular::EmbeddedFile *ef, QWidget *parent )
|
||||
|
|
|
@ -37,7 +37,8 @@ namespace GuiUtils
|
|||
|
||||
QPixmap loadStamp( const QString& name, const QSize& size, int iconSize = 0 );
|
||||
|
||||
void setIconLoader( KIconLoader * loader );
|
||||
void addIconLoader( KIconLoader * loader );
|
||||
void removeIconLoader( KIconLoader * loader );
|
||||
KIconLoader* iconLoader();
|
||||
|
||||
void saveEmbeddedFile( Okular::EmbeddedFile *ef, QWidget *parent );
|
||||
|
|
Loading…
Reference in a new issue