Avoid excessively long startup time due to oversized tray icon creation when icon widget has not yet been shown

pull/1/head
Timothy Pearson 10 years ago
parent 98d74ed28d
commit da2a240890

@ -171,10 +171,10 @@ TopLevel::TopLevel() : KSystemTray()
action = config->readEntry("Action"); action = config->readEntry("Action");
useTrayVis = config->readBoolEntry("UseTrayVis", true); useTrayVis = config->readBoolEntry("UseTrayVis", true);
mugPixmap = loadSizedIcon("mug", width()); mugPixmap = loadIcon("mug");
teaNotReadyPixmap = loadSizedIcon("tea_not_ready", width()); teaNotReadyPixmap = loadIcon("tea_not_ready");
teaAnim1Pixmap = loadSizedIcon("tea_anim1", width()); teaAnim1Pixmap = loadIcon("tea_anim1");
teaAnim2Pixmap = loadSizedIcon("tea_anim2", width()); teaAnim2Pixmap = loadIcon("tea_anim2");
confdlg = 0L; confdlg = 0L;
anondlg = 0L; anondlg = 0L;
@ -201,8 +201,8 @@ TopLevel::~TopLevel()
// FIXME: must delete more (like all the TQWidgets in config-window)? // FIXME: must delete more (like all the TQWidgets in config-window)?
} }
void TopLevel::resizeEvent ( TQResizeEvent * ) void TopLevel::resizeTrayIcon () {
{ // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
mugPixmap = loadSizedIcon("mug", width()); mugPixmap = loadSizedIcon("mug", width());
teaNotReadyPixmap = loadSizedIcon("tea_not_ready", width()); teaNotReadyPixmap = loadSizedIcon("tea_not_ready", width());
teaAnim1Pixmap = loadSizedIcon("tea_anim1", width()); teaAnim1Pixmap = loadSizedIcon("tea_anim1", width());
@ -210,6 +210,18 @@ void TopLevel::resizeEvent ( TQResizeEvent * )
repaint(); repaint();
} }
void TopLevel::resizeEvent ( TQResizeEvent * )
{
// Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
resizeTrayIcon();
}
void TopLevel::showEvent ( TQShowEvent * )
{
// Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
resizeTrayIcon();
}
/** Handle mousePressEvent */ /** Handle mousePressEvent */
void TopLevel::mousePressEvent(TQMouseEvent *event) void TopLevel::mousePressEvent(TQMouseEvent *event)
{ {

@ -56,6 +56,7 @@ protected:
void mousePressEvent(TQMouseEvent *); void mousePressEvent(TQMouseEvent *);
void timerEvent(TQTimerEvent *); void timerEvent(TQTimerEvent *);
void resizeEvent(TQResizeEvent *); void resizeEvent(TQResizeEvent *);
void showEvent(TQShowEvent *);
private slots: private slots:
@ -83,6 +84,9 @@ private slots:
void enable_controls(); void enable_controls();
void actionEnableToggled(bool on); void actionEnableToggled(bool on);
private:
void resizeTrayIcon();
private: private:
static const int DEFAULT_TEA_TIME; static const int DEFAULT_TEA_TIME;

Loading…
Cancel
Save