~gerboland/unity-2d/launcher-menu-mouse-focus

« back to all changes in this revision

Viewing changes to panel/applets/appname/appnameapplet.cpp

  • Committer: Tarmac
  • Author(s): Alberto Mardegan
  • Date: 2011-10-10 11:53:22 UTC
  • mfrom: (749.2.2 titlebar)
  • Revision ID: tarmac-20111010115322-zn31fu6xzgfhe7z3
[panel] Ensure title label has correct length at all times

This fixes a problem which happens for instance when invoking the Dash via 
Alt+F2 while there's an application active on the desktop: the title label is
displayed, but its length is fixed to a small value, and it would appear at the
centre of the panel available space.

Show diffs side-by-side

added added

removed removed

Lines of Context:
250
250
 
251
251
    d->m_windowButtonWidget->setVisible(showWindowButtons);
252
252
 
253
 
    d->m_label->setVisible(showAppLabel || showDesktopLabel);
254
 
    if (showAppLabel) {
255
 
        // Define text
256
 
        QString text;
257
 
        if (app) {
258
 
            if (isMaximized) {
259
 
                // When maximized, show window title
260
 
                BamfWindow* bamfWindow = BamfMatcher::get_default().active_window();
261
 
                if (bamfWindow) {
262
 
                    text = bamfWindow->name();
 
253
    if (showAppLabel || showDesktopLabel) {
 
254
        d->m_label->setVisible(true);
 
255
        if (showAppLabel) {
 
256
            // Define text
 
257
            QString text;
 
258
            if (app) {
 
259
                if (isMaximized) {
 
260
                    // When maximized, show window title
 
261
                    BamfWindow* bamfWindow = BamfMatcher::get_default().active_window();
 
262
                    if (bamfWindow) {
 
263
                        text = bamfWindow->name();
 
264
                    }
 
265
                } else {
 
266
                    // When not maximized, show application name
 
267
                    text = app->name();
263
268
                }
264
 
            } else {
265
 
                // When not maximized, show application name
266
 
                text = app->name();
267
269
            }
 
270
            d->m_label->setText(text);
 
271
        } else if (showDesktopLabel) {
 
272
            d->m_label->setText(u2dTr("Desktop", "nautilus"));
268
273
        }
269
 
        d->m_label->setText(text);
270
274
 
271
 
        // Define width
 
275
        // Define label width
272
276
        if (!isMaximized && showMenu) {
273
277
            d->m_label->setMaximumWidth(LauncherClient::MaximumWidth);
274
278
        } else {
275
279
            d->m_label->setMaximumWidth(QWIDGETSIZE_MAX);
276
280
        }
277
 
    } else if (showDesktopLabel) {
278
 
        d->m_label->setText(u2dTr("Desktop", "nautilus"));
 
281
    } else {
 
282
        d->m_label->setVisible(false);
279
283
    }
280
284
 
281
285
    d->m_menuBarWidget->setVisible(showMenu);