|
|
@ -55,63 +55,63 @@ enum ExtendedContext
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ALL = 0,
|
|
|
|
ALL = 0,
|
|
|
|
RECENT = 1,
|
|
|
|
RECENT = 1,
|
|
|
|
// Action thru MimeType, subtract 1 to convert to KIcon::Context
|
|
|
|
// Action thru MimeType, subtract 1 to convert to TDEIcon::Context
|
|
|
|
OTHER = 7
|
|
|
|
OTHER = 7
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class KIconDialog::KIconDialogPrivate
|
|
|
|
class TDEIconDialog::TDEIconDialogPrivate
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
KIconDialogPrivate() {
|
|
|
|
TDEIconDialogPrivate() {
|
|
|
|
m_bStrictIconSize = true;
|
|
|
|
m_bStrictIconSize = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
~KIconDialogPrivate() {}
|
|
|
|
~TDEIconDialogPrivate() {}
|
|
|
|
bool m_bStrictIconSize;
|
|
|
|
bool m_bStrictIconSize;
|
|
|
|
TQString custom;
|
|
|
|
TQString custom;
|
|
|
|
TQString customLocation;
|
|
|
|
TQString customLocation;
|
|
|
|
int recentMax;
|
|
|
|
int recentMax;
|
|
|
|
TQStringList recentList;
|
|
|
|
TQStringList recentList;
|
|
|
|
ExtendedContext extendedContext;
|
|
|
|
ExtendedContext extendedContext;
|
|
|
|
KIconDialogUI *ui; /* FIXME: KDE4 probably move this to the main class */
|
|
|
|
TDEIconDialogUI *ui; /* FIXME: KDE4 probably move this to the main class */
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* KIconDialog: Dialog for selecting icons. Both system and user
|
|
|
|
* TDEIconDialog: Dialog for selecting icons. Both system and user
|
|
|
|
* specified icons can be chosen.
|
|
|
|
* specified icons can be chosen.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
KIconDialog::KIconDialog(TQWidget *parent, const char*)
|
|
|
|
TDEIconDialog::TDEIconDialog(TQWidget *parent, const char*)
|
|
|
|
: KDialogBase(parent, "IconDialog", true, i18n("Select Icon"), Ok|Cancel, Ok)
|
|
|
|
: KDialogBase(parent, "IconDialog", true, i18n("Select Icon"), Ok|Cancel, Ok)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d = new KIconDialogPrivate;
|
|
|
|
d = new TDEIconDialogPrivate;
|
|
|
|
mpLoader = TDEGlobal::iconLoader();
|
|
|
|
mpLoader = TDEGlobal::iconLoader();
|
|
|
|
init();
|
|
|
|
init();
|
|
|
|
resize(minimumSize());
|
|
|
|
resize(minimumSize());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
KIconDialog::KIconDialog(KIconLoader *loader, TQWidget *parent,
|
|
|
|
TDEIconDialog::TDEIconDialog(TDEIconLoader *loader, TQWidget *parent,
|
|
|
|
const char *name)
|
|
|
|
const char *name)
|
|
|
|
: KDialogBase(parent, name, true, i18n("Select Icon"), Ok|Cancel, Ok)
|
|
|
|
: KDialogBase(parent, name, true, i18n("Select Icon"), Ok|Cancel, Ok)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d = new KIconDialogPrivate;
|
|
|
|
d = new TDEIconDialogPrivate;
|
|
|
|
mpLoader = loader;
|
|
|
|
mpLoader = loader;
|
|
|
|
init();
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconDialog::init()
|
|
|
|
void TDEIconDialog::init()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mGroupOrSize = KIcon::Desktop;
|
|
|
|
mGroupOrSize = TDEIcon::Desktop;
|
|
|
|
d->extendedContext = ALL;
|
|
|
|
d->extendedContext = ALL;
|
|
|
|
mType = 0;
|
|
|
|
mType = 0;
|
|
|
|
setCustomLocation(TQString()); // Initialize mFileList
|
|
|
|
setCustomLocation(TQString()); // Initialize mFileList
|
|
|
|
|
|
|
|
|
|
|
|
// Read configuration
|
|
|
|
// Read configuration
|
|
|
|
TDEConfig *config = TDEGlobal::config();
|
|
|
|
TDEConfig *config = TDEGlobal::config();
|
|
|
|
TDEConfigGroupSaver saver(config, "KIconDialog");
|
|
|
|
TDEConfigGroupSaver saver(config, "TDEIconDialog");
|
|
|
|
d->recentMax = config->readNumEntry("RecentMax", 10);
|
|
|
|
d->recentMax = config->readNumEntry("RecentMax", 10);
|
|
|
|
d->recentList = config->readPathListEntry("RecentIcons");
|
|
|
|
d->recentList = config->readPathListEntry("RecentIcons");
|
|
|
|
|
|
|
|
|
|
|
|
d->ui = new KIconDialogUI( this );
|
|
|
|
d->ui = new TDEIconDialogUI( this );
|
|
|
|
setMainWidget(d->ui);
|
|
|
|
setMainWidget(d->ui);
|
|
|
|
|
|
|
|
|
|
|
|
d->ui->searchLine->setIconView(d->ui->iconCanvas);
|
|
|
|
d->ui->searchLine->setIconView(d->ui->iconCanvas);
|
|
|
@ -140,28 +140,28 @@ void KIconDialog::init()
|
|
|
|
d->ui->listBox->insertItem(i18n("Miscellaneous"));
|
|
|
|
d->ui->listBox->insertItem(i18n("Miscellaneous"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
KIconDialog::~KIconDialog()
|
|
|
|
TDEIconDialog::~TDEIconDialog()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Write configuration
|
|
|
|
// Write configuration
|
|
|
|
TDEConfig *config = TDEGlobal::config();
|
|
|
|
TDEConfig *config = TDEGlobal::config();
|
|
|
|
TDEConfigGroupSaver saver(config, "KIconDialog");
|
|
|
|
TDEConfigGroupSaver saver(config, "TDEIconDialog");
|
|
|
|
config->writeEntry("RecentMax", d->recentMax, true, true);
|
|
|
|
config->writeEntry("RecentMax", d->recentMax, true, true);
|
|
|
|
config->writePathEntry("RecentIcons", d->recentList, ',', true, true);
|
|
|
|
config->writePathEntry("RecentIcons", d->recentList, ',', true, true);
|
|
|
|
|
|
|
|
|
|
|
|
delete d;
|
|
|
|
delete d;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconDialog::slotAcceptIcons()
|
|
|
|
void TDEIconDialog::slotAcceptIcons()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//FIXME: not used anymore
|
|
|
|
//FIXME: not used anymore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconDialog::showIcons()
|
|
|
|
void TDEIconDialog::showIcons()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->ui->iconCanvas->clear();
|
|
|
|
d->ui->iconCanvas->clear();
|
|
|
|
TQStringList filelist;
|
|
|
|
TQStringList filelist;
|
|
|
|
|
|
|
|
|
|
|
|
KIcon::Context context = static_cast<KIcon::Context>(d->extendedContext - 1);
|
|
|
|
TDEIcon::Context context = static_cast<TDEIcon::Context>(d->extendedContext - 1);
|
|
|
|
switch (d->extendedContext)
|
|
|
|
switch (d->extendedContext)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case RECENT:
|
|
|
|
case RECENT:
|
|
|
@ -172,7 +172,7 @@ void KIconDialog::showIcons()
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case ALL:
|
|
|
|
case ALL:
|
|
|
|
filelist = mFileList;
|
|
|
|
filelist = mFileList;
|
|
|
|
context = KIcon::Any;
|
|
|
|
context = TDEIcon::Any;
|
|
|
|
// ** Fallthrough to next case **
|
|
|
|
// ** Fallthrough to next case **
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
TQStringList list;
|
|
|
|
TQStringList list;
|
|
|
@ -206,46 +206,46 @@ void KIconDialog::showIcons()
|
|
|
|
d->ui->iconCanvas->loadFiles(filelist);
|
|
|
|
d->ui->iconCanvas->loadFiles(filelist);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconDialog::setStrictIconSize(bool b)
|
|
|
|
void TDEIconDialog::setStrictIconSize(bool b)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->m_bStrictIconSize=b;
|
|
|
|
d->m_bStrictIconSize=b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool KIconDialog::strictIconSize() const
|
|
|
|
bool TDEIconDialog::strictIconSize() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return d->m_bStrictIconSize;
|
|
|
|
return d->m_bStrictIconSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconDialog::setIconSize( int size )
|
|
|
|
void TDEIconDialog::setIconSize( int size )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// see KIconLoader, if you think this is weird
|
|
|
|
// see TDEIconLoader, if you think this is weird
|
|
|
|
if ( size == 0 )
|
|
|
|
if ( size == 0 )
|
|
|
|
mGroupOrSize = KIcon::Desktop; // default Group
|
|
|
|
mGroupOrSize = TDEIcon::Desktop; // default Group
|
|
|
|
else
|
|
|
|
else
|
|
|
|
mGroupOrSize = -size; // yes, KIconLoader::queryIconsByContext is weird
|
|
|
|
mGroupOrSize = -size; // yes, TDEIconLoader::queryIconsByContext is weird
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int KIconDialog::iconSize() const
|
|
|
|
int TDEIconDialog::iconSize() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 0 or any other value ==> mGroupOrSize is a group, so we return 0
|
|
|
|
// 0 or any other value ==> mGroupOrSize is a group, so we return 0
|
|
|
|
return (mGroupOrSize < 0) ? -mGroupOrSize : 0;
|
|
|
|
return (mGroupOrSize < 0) ? -mGroupOrSize : 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef KDE_NO_COMPAT
|
|
|
|
#ifndef KDE_NO_COMPAT
|
|
|
|
TQString KIconDialog::selectIcon(KIcon::Group group, KIcon::Context context, bool user)
|
|
|
|
TQString TDEIconDialog::selectIcon(TDEIcon::Group group, TDEIcon::Context context, bool user)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
setup( group, context, false, 0, user );
|
|
|
|
setup( group, context, false, 0, user );
|
|
|
|
return openDialog();
|
|
|
|
return openDialog();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
void KIconDialog::setup(KIcon::Group group, KIcon::Context context,
|
|
|
|
void TDEIconDialog::setup(TDEIcon::Group group, TDEIcon::Context context,
|
|
|
|
bool strictIconSize, int iconSize, bool user )
|
|
|
|
bool strictIconSize, int iconSize, bool user )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
setup(group, context, strictIconSize, iconSize, user, false, false);
|
|
|
|
setup(group, context, strictIconSize, iconSize, user, false, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconDialog::setup(KIcon::Group group, KIcon::Context context,
|
|
|
|
void TDEIconDialog::setup(TDEIcon::Group group, TDEIcon::Context context,
|
|
|
|
bool strictIconSize, int iconSize, bool user,
|
|
|
|
bool strictIconSize, int iconSize, bool user,
|
|
|
|
bool lockContext, bool lockBrowse )
|
|
|
|
bool lockContext, bool lockBrowse )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -254,7 +254,7 @@ void KIconDialog::setup(KIcon::Group group, KIcon::Context context,
|
|
|
|
mGroupOrSize = (iconSize == 0) ? group : -iconSize;
|
|
|
|
mGroupOrSize = (iconSize == 0) ? group : -iconSize;
|
|
|
|
mType = user;
|
|
|
|
mType = user;
|
|
|
|
|
|
|
|
|
|
|
|
d->extendedContext = static_cast<ExtendedContext>( ( context == KIcon::Any ) ? ALL : context + 1 );
|
|
|
|
d->extendedContext = static_cast<ExtendedContext>( ( context == TDEIcon::Any ) ? ALL : context + 1 );
|
|
|
|
|
|
|
|
|
|
|
|
// We cannot change layout because it is protected ;-(
|
|
|
|
// We cannot change layout because it is protected ;-(
|
|
|
|
// FIXME: TQt4 we will be able to inherit from both TQDialog and our GUI
|
|
|
|
// FIXME: TQt4 we will be able to inherit from both TQDialog and our GUI
|
|
|
@ -266,12 +266,12 @@ void KIconDialog::setup(KIcon::Group group, KIcon::Context context,
|
|
|
|
d->ui->listBox->setCurrentItem(d->extendedContext);
|
|
|
|
d->ui->listBox->setCurrentItem(d->extendedContext);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const TQString & KIconDialog::customLocation( ) const
|
|
|
|
const TQString & TDEIconDialog::customLocation( ) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return d->customLocation;
|
|
|
|
return d->customLocation;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconDialog::setCustomLocation( const TQString& location )
|
|
|
|
void TDEIconDialog::setCustomLocation( const TQString& location )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->customLocation = location;
|
|
|
|
d->customLocation = location;
|
|
|
|
|
|
|
|
|
|
|
@ -283,7 +283,7 @@ void KIconDialog::setCustomLocation( const TQString& location )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQString KIconDialog::openDialog()
|
|
|
|
TQString TDEIconDialog::openDialog()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
showIcons();
|
|
|
|
showIcons();
|
|
|
|
|
|
|
|
|
|
|
@ -300,7 +300,7 @@ TQString KIconDialog::openDialog()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconDialog::showDialog()
|
|
|
|
void TDEIconDialog::showDialog()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->custom = TQString();
|
|
|
|
d->custom = TQString();
|
|
|
|
|
|
|
|
|
|
|
@ -318,7 +318,7 @@ void KIconDialog::showDialog()
|
|
|
|
showIcons();
|
|
|
|
showIcons();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconDialog::slotOk()
|
|
|
|
void TDEIconDialog::slotOk()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQString key = !d->custom.isEmpty() ? d->custom : d->ui->iconCanvas->getCurrent();
|
|
|
|
TQString key = !d->custom.isEmpty() ? d->custom : d->ui->iconCanvas->getCurrent();
|
|
|
|
|
|
|
|
|
|
|
@ -336,11 +336,11 @@ void KIconDialog::slotOk()
|
|
|
|
KDialogBase::slotOk();
|
|
|
|
KDialogBase::slotOk();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQString KIconDialog::getIcon(KIcon::Group group, KIcon::Context context,
|
|
|
|
TQString TDEIconDialog::getIcon(TDEIcon::Group group, TDEIcon::Context context,
|
|
|
|
bool strictIconSize, int iconSize, bool user,
|
|
|
|
bool strictIconSize, int iconSize, bool user,
|
|
|
|
TQWidget *parent, const TQString &caption)
|
|
|
|
TQWidget *parent, const TQString &caption)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KIconDialog dlg(parent, "icon dialog");
|
|
|
|
TDEIconDialog dlg(parent, "icon dialog");
|
|
|
|
dlg.setup( group, context, strictIconSize, iconSize, user );
|
|
|
|
dlg.setup( group, context, strictIconSize, iconSize, user );
|
|
|
|
if (!caption.isNull())
|
|
|
|
if (!caption.isNull())
|
|
|
|
dlg.setCaption(caption);
|
|
|
|
dlg.setCaption(caption);
|
|
|
@ -348,7 +348,7 @@ TQString KIconDialog::getIcon(KIcon::Group group, KIcon::Context context,
|
|
|
|
return dlg.openDialog();
|
|
|
|
return dlg.openDialog();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconDialog::slotBrowse()
|
|
|
|
void TDEIconDialog::slotBrowse()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Create a file dialog to select a PNG, XPM or SVG file,
|
|
|
|
// Create a file dialog to select a PNG, XPM or SVG file,
|
|
|
|
// with the image previewer shown.
|
|
|
|
// with the image previewer shown.
|
|
|
@ -372,13 +372,13 @@ void KIconDialog::slotBrowse()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconDialog::slotContext(int id)
|
|
|
|
void TDEIconDialog::slotContext(int id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->extendedContext = static_cast<ExtendedContext>(id);
|
|
|
|
d->extendedContext = static_cast<ExtendedContext>(id);
|
|
|
|
showIcons();
|
|
|
|
showIcons();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconDialog::slotStartLoading(int steps)
|
|
|
|
void TDEIconDialog::slotStartLoading(int steps)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (steps < 10)
|
|
|
|
if (steps < 10)
|
|
|
|
d->ui->progressBar->hide();
|
|
|
|
d->ui->progressBar->hide();
|
|
|
@ -392,26 +392,26 @@ void KIconDialog::slotStartLoading(int steps)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconDialog::slotProgress(int p)
|
|
|
|
void TDEIconDialog::slotProgress(int p)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->ui->progressBar->setProgress(p);
|
|
|
|
d->ui->progressBar->setProgress(p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconDialog::slotFinished()
|
|
|
|
void TDEIconDialog::slotFinished()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->ui->progressBar->hide();
|
|
|
|
d->ui->progressBar->hide();
|
|
|
|
d->ui->filterLabel->show();
|
|
|
|
d->ui->filterLabel->show();
|
|
|
|
d->ui->searchLine->show();
|
|
|
|
d->ui->searchLine->show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class KIconButton::KIconButtonPrivate
|
|
|
|
class TDEIconButton::TDEIconButtonPrivate
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
KIconButtonPrivate() {
|
|
|
|
TDEIconButtonPrivate() {
|
|
|
|
m_bStrictIconSize = false;
|
|
|
|
m_bStrictIconSize = false;
|
|
|
|
iconSize = 0; // let KIconLoader choose the default
|
|
|
|
iconSize = 0; // let TDEIconLoader choose the default
|
|
|
|
}
|
|
|
|
}
|
|
|
|
~KIconButtonPrivate() {}
|
|
|
|
~TDEIconButtonPrivate() {}
|
|
|
|
bool m_bStrictIconSize;
|
|
|
|
bool m_bStrictIconSize;
|
|
|
|
bool lockUser;
|
|
|
|
bool lockUser;
|
|
|
|
bool lockCustom;
|
|
|
|
bool lockCustom;
|
|
|
@ -420,27 +420,27 @@ class KIconButton::KIconButtonPrivate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* KIconButton: A "choose icon" pushbutton.
|
|
|
|
* TDEIconButton: A "choose icon" pushbutton.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
KIconButton::KIconButton(TQWidget *parent, const char *name)
|
|
|
|
TDEIconButton::TDEIconButton(TQWidget *parent, const char *name)
|
|
|
|
: TQPushButton(parent, name)
|
|
|
|
: TQPushButton(parent, name)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
init( TDEGlobal::iconLoader() );
|
|
|
|
init( TDEGlobal::iconLoader() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
KIconButton::KIconButton(KIconLoader *loader,
|
|
|
|
TDEIconButton::TDEIconButton(TDEIconLoader *loader,
|
|
|
|
TQWidget *parent, const char *name)
|
|
|
|
TQWidget *parent, const char *name)
|
|
|
|
: TQPushButton(parent, name)
|
|
|
|
: TQPushButton(parent, name)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
init( loader );
|
|
|
|
init( loader );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconButton::init( KIconLoader *loader )
|
|
|
|
void TDEIconButton::init( TDEIconLoader *loader )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d = new KIconButtonPrivate;
|
|
|
|
d = new TDEIconButtonPrivate;
|
|
|
|
mGroup = KIcon::Desktop;
|
|
|
|
mGroup = TDEIcon::Desktop;
|
|
|
|
mContext = KIcon::Application;
|
|
|
|
mContext = TDEIcon::Application;
|
|
|
|
mbUser = false;
|
|
|
|
mbUser = false;
|
|
|
|
|
|
|
|
|
|
|
|
mpLoader = loader;
|
|
|
|
mpLoader = loader;
|
|
|
@ -448,33 +448,33 @@ void KIconButton::init( KIconLoader *loader )
|
|
|
|
connect(this, TQT_SIGNAL(clicked()), TQT_SLOT(slotChangeIcon()));
|
|
|
|
connect(this, TQT_SIGNAL(clicked()), TQT_SLOT(slotChangeIcon()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
KIconButton::~KIconButton()
|
|
|
|
TDEIconButton::~TDEIconButton()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
delete mpDialog;
|
|
|
|
delete mpDialog;
|
|
|
|
delete d;
|
|
|
|
delete d;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconButton::setStrictIconSize(bool b)
|
|
|
|
void TDEIconButton::setStrictIconSize(bool b)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->m_bStrictIconSize=b;
|
|
|
|
d->m_bStrictIconSize=b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool KIconButton::strictIconSize() const
|
|
|
|
bool TDEIconButton::strictIconSize() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return d->m_bStrictIconSize;
|
|
|
|
return d->m_bStrictIconSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconButton::setIconSize( int size )
|
|
|
|
void TDEIconButton::setIconSize( int size )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->iconSize = size;
|
|
|
|
d->iconSize = size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int KIconButton::iconSize() const
|
|
|
|
int TDEIconButton::iconSize() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return d->iconSize;
|
|
|
|
return d->iconSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconButton::setIconType(KIcon::Group group, KIcon::Context context, bool user)
|
|
|
|
void TDEIconButton::setIconType(TDEIcon::Group group, TDEIcon::Context context, bool user)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mGroup = group;
|
|
|
|
mGroup = group;
|
|
|
|
mContext = context;
|
|
|
|
mContext = context;
|
|
|
@ -483,7 +483,7 @@ void KIconButton::setIconType(KIcon::Group group, KIcon::Context context, bool u
|
|
|
|
d->lockCustom = false;
|
|
|
|
d->lockCustom = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconButton::setIconType(KIcon::Group group, KIcon::Context context, bool user, bool lockUser, bool lockCustom)
|
|
|
|
void TDEIconButton::setIconType(TDEIcon::Group group, TDEIcon::Context context, bool user, bool lockUser, bool lockCustom)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mGroup = group;
|
|
|
|
mGroup = group;
|
|
|
|
mContext = context;
|
|
|
|
mContext = context;
|
|
|
@ -492,45 +492,45 @@ void KIconButton::setIconType(KIcon::Group group, KIcon::Context context, bool u
|
|
|
|
d->lockCustom = lockCustom;
|
|
|
|
d->lockCustom = lockCustom;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconButton::setIcon(const TQString& icon)
|
|
|
|
void TDEIconButton::setIcon(const TQString& icon)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mIcon = icon;
|
|
|
|
mIcon = icon;
|
|
|
|
setIconSet(mpLoader->loadIconSet(mIcon, mGroup, d->iconSize));
|
|
|
|
setIconSet(mpLoader->loadIconSet(mIcon, mGroup, d->iconSize));
|
|
|
|
|
|
|
|
|
|
|
|
if (!mpDialog)
|
|
|
|
if (!mpDialog)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mpDialog = new KIconDialog(mpLoader, this);
|
|
|
|
mpDialog = new TDEIconDialog(mpLoader, this);
|
|
|
|
connect(mpDialog, TQT_SIGNAL(newIconName(const TQString&)), TQT_SLOT(newIconName(const TQString&)));
|
|
|
|
connect(mpDialog, TQT_SIGNAL(newIconName(const TQString&)), TQT_SLOT(newIconName(const TQString&)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const TQString & KIconButton::customLocation( ) const
|
|
|
|
const TQString & TDEIconButton::customLocation( ) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return mpDialog ? mpDialog->customLocation() : TQString();
|
|
|
|
return mpDialog ? mpDialog->customLocation() : TQString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconButton::setCustomLocation(const TQString &custom)
|
|
|
|
void TDEIconButton::setCustomLocation(const TQString &custom)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!mpDialog)
|
|
|
|
if (!mpDialog)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mpDialog = new KIconDialog(mpLoader, this);
|
|
|
|
mpDialog = new TDEIconDialog(mpLoader, this);
|
|
|
|
connect(mpDialog, TQT_SIGNAL(newIconName(const TQString&)), TQT_SLOT(newIconName(const TQString&)));
|
|
|
|
connect(mpDialog, TQT_SIGNAL(newIconName(const TQString&)), TQT_SLOT(newIconName(const TQString&)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
mpDialog->setCustomLocation(custom);
|
|
|
|
mpDialog->setCustomLocation(custom);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconButton::resetIcon()
|
|
|
|
void TDEIconButton::resetIcon()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mIcon = TQString();
|
|
|
|
mIcon = TQString();
|
|
|
|
setIconSet(TQIconSet());
|
|
|
|
setIconSet(TQIconSet());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconButton::slotChangeIcon()
|
|
|
|
void TDEIconButton::slotChangeIcon()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!mpDialog)
|
|
|
|
if (!mpDialog)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mpDialog = new KIconDialog(mpLoader, this);
|
|
|
|
mpDialog = new TDEIconDialog(mpLoader, this);
|
|
|
|
connect(mpDialog, TQT_SIGNAL(newIconName(const TQString&)), TQT_SLOT(newIconName(const TQString&)));
|
|
|
|
connect(mpDialog, TQT_SIGNAL(newIconName(const TQString&)), TQT_SLOT(newIconName(const TQString&)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -538,7 +538,7 @@ void KIconButton::slotChangeIcon()
|
|
|
|
mpDialog->showDialog();
|
|
|
|
mpDialog->showDialog();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconButton::newIconName(const TQString& name)
|
|
|
|
void TDEIconButton::newIconName(const TQString& name)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (name.isEmpty())
|
|
|
|
if (name.isEmpty())
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -550,10 +550,10 @@ void KIconButton::newIconName(const TQString& name)
|
|
|
|
emit iconChanged(name);
|
|
|
|
emit iconChanged(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KIconCanvas::virtual_hook( int id, void* data )
|
|
|
|
void TDEIconCanvas::virtual_hook( int id, void* data )
|
|
|
|
{ KIconView::virtual_hook( id, data ); }
|
|
|
|
{ TDEIconView::virtual_hook( id, data ); }
|
|
|
|
|
|
|
|
|
|
|
|
void KIconDialog::virtual_hook( int id, void* data )
|
|
|
|
void TDEIconDialog::virtual_hook( int id, void* data )
|
|
|
|
{ KDialogBase::virtual_hook( id, data ); }
|
|
|
|
{ KDialogBase::virtual_hook( id, data ); }
|
|
|
|
|
|
|
|
|
|
|
|
#include "kicondialog.moc"
|
|
|
|
#include "kicondialog.moc"
|
|
|
|