예제 #1
0
void DesktopCorona::init()
{
    setPreferredToolBoxPlugin(Plasma::Containment::DesktopContainment, "org.kde.desktoptoolbox");
    setPreferredToolBoxPlugin(Plasma::Containment::CustomContainment, "org.kde.desktoptoolbox");
    setPreferredToolBoxPlugin(Plasma::Containment::PanelContainment, "org.kde.paneltoolbox");
    setPreferredToolBoxPlugin(Plasma::Containment::CustomPanelContainment, "org.kde.paneltoolbox");

    kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "DesktopCorona init start" << "(line:" << __LINE__ << ")";
    Kephal::Screens *screens = Kephal::Screens::self();
    connect(screens, SIGNAL(screenAdded(Kephal::Screen*)), SLOT(screenAdded(Kephal::Screen*)));
    connect(KWindowSystem::self(), SIGNAL(workAreaChanged()), this, SIGNAL(availableScreenRegionChanged()));

    Plasma::ContainmentActionsPluginsConfig desktopPlugins;
    desktopPlugins.addPlugin(Qt::NoModifier, Qt::Vertical, "switchdesktop");
    desktopPlugins.addPlugin(Qt::NoModifier, Qt::MidButton, "paste");
    desktopPlugins.addPlugin(Qt::NoModifier, Qt::RightButton, "contextmenu");
    Plasma::ContainmentActionsPluginsConfig panelPlugins;
    panelPlugins.addPlugin(Qt::NoModifier, Qt::RightButton, "contextmenu");

    setContainmentActionsDefaults(Plasma::Containment::DesktopContainment, desktopPlugins);
    setContainmentActionsDefaults(Plasma::Containment::CustomContainment, desktopPlugins);
    setContainmentActionsDefaults(Plasma::Containment::PanelContainment, panelPlugins);
    setContainmentActionsDefaults(Plasma::Containment::CustomPanelContainment, panelPlugins);

    checkAddPanelAction();

    //why do these actions belong to plasmaapp?
    //because it makes the keyboard shortcuts work.
    KAction *action = new KAction(PlasmaApp::self());
    action->setText(i18n("Next Activity"));
    action->setObjectName( QLatin1String("Next Activity" )); // NO I18N
    action->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Tab));
    connect(action, SIGNAL(triggered()), this, SLOT(activateNextActivity()));

    action = new KAction(PlasmaApp::self());
    action->setText(i18n("Previous Activity"));
    action->setObjectName( QLatin1String("Previous Activity" )); // NO I18N
    action->setGlobalShortcut(KShortcut(Qt::META + Qt::SHIFT + Qt::Key_Tab));
    connect(action, SIGNAL(triggered()), this, SLOT(activatePreviousActivity()));

    connect(this, SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)),
            this, SLOT(updateImmutability(Plasma::ImmutabilityType)));
    connect(KSycoca::self(), SIGNAL(databaseChanged(QStringList)), this, SLOT(checkAddPanelAction(QStringList)));

    connect(m_activityController, SIGNAL(currentActivityChanged(QString)), this, SLOT(currentActivityChanged(QString)));
    connect(m_activityController, SIGNAL(activityAdded(QString)), this, SLOT(activityAdded(QString)));
    connect(m_activityController, SIGNAL(activityRemoved(QString)), this, SLOT(activityRemoved(QString)));

    mapAnimation(Plasma::Animator::AppearAnimation, Plasma::Animator::ZoomAnimation);
    mapAnimation(Plasma::Animator::DisappearAnimation, Plasma::Animator::ZoomAnimation);
    kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "DesktopCorona init end" << "(line:" << __LINE__ << ")";
}
예제 #2
0
void KGlobalShortcutTest::testOverrideMainComponentData()
{
    setupTest("testOverrideMainComponentData");

    KComponentData otherComponent("test_component1");
    KActionCollection coll((QObject*)NULL);
    coll.setComponentData(otherComponent);
    KShortcut cutB;

    // Action without action collection
    KAction *action = new KAction("Text For Action A", this);
    QVERIFY(action->d->componentData == KGlobal::mainComponent());
    action->setObjectName("Action A");
    action->setGlobalShortcut(cutB, KAction::ActiveShortcut, KAction::NoAutoloading);
    QVERIFY(action->d->componentData == KGlobal::mainComponent());

    // Action with action collection
    action->forgetGlobalShortcut();
    delete action;
    action = coll.addAction("Action A");
    QVERIFY(action->d->componentData == otherComponent);
    action->setGlobalShortcut(cutB, KAction::ActiveShortcut, KAction::NoAutoloading);
    QVERIFY(action->d->componentData == otherComponent);

    // cleanup
    action->forgetGlobalShortcut();
    delete coll.takeAction(action);

}
KAction *create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent)
{
    KAction *pAction = 0;
    const Info* pInfo = infoPtr(id);

    if (pInfo) {
        pAction = new KAction(parent);
        pAction->setObjectName(pInfo->psName);
        KShortcut cut(pInfo->shortcut);
        if (!cut.isEmpty())
            pAction->setShortcut(cut);
        pAction->setText(i18n(pInfo->psText));
        pAction->setToolTip(i18n(pInfo->psToolTip));
        pAction->setWhatsThis(i18n(pInfo->psWhatsThis));
        if (pInfo->psIconName)
            pAction->setIcon(KIcon(QLatin1String(pInfo->psIconName)));
    }

    if (recvr && slot)
        QObject::connect(pAction, SIGNAL(triggered(bool)), recvr, slot);

    if (pAction) {
        KActionCollection *collection = qobject_cast<KActionCollection *>(parent);
        if (collection)
            collection->addAction(pAction->objectName(), pAction);
    }
    return pAction;
}
예제 #4
0
void MainWindow::addGlobalShortcut(QKeySequence shortcut,
                                   QObject *object,
                                   const char *slot,
                                   QString name) {
    KAction *action = new KAction(name, this);
    action->setObjectName(name);
    action->setGlobalShortcut(KShortcut(shortcut), KAction::ActiveShortcut, KAction::Autoloading);
    QObject::connect(action, SIGNAL(triggered()), object, slot);
}
예제 #5
0
void Part::createGUIClients()//KexiMainWindow *win)
{
// d->mainWin = win;
    if (!d->guiClient) {
        //create part's gui client
        d->guiClient = new GUIClient(this, false, "part");

        //default actions for part's gui client:
        KAction *act = new KAction(
            KIcon(info()->createItemIcon()),
            instanceCaption() + "...",
            KexiMainWindowIface::global()->actionCollection()
        );
        act->setObjectName(KexiPart::nameForCreateAction(*info()));
        QString defaultToolTip(i18n("Create new object of type \"%1\"", instanceCaption().toLower()));
        act->setToolTip(internalPropertyValue("instanceToolTip", defaultToolTip).toString());
        QString defaultWhatsThis(i18n("Creates new object of type \"%1\"", instanceCaption().toLower()));
        act->setWhatsThis(internalPropertyValue("instanceWhatsThis", defaultWhatsThis).toString());
        connect(act, SIGNAL(triggered()), this, SLOT(slotCreate()));
        KexiMainWindowIface::global()->actionCollection()->addAction(act->objectName(), act);
#ifdef __GNUC__
#warning TODO  KexiMainWindowIface::global()->guiFactory()->addClient(d->guiClient); //this client is added permanently
#else
#pragma WARNING( TODO  KexiMainWindowIface::global()->guiFactory()->addClient(d->guiClient); )
#endif

        //default actions for part instance's gui client:
        //NONE
        //let init specific actions for part instances
        for (int mode = 1; mode <= 0x01000; mode <<= 1) {
            if (d->supportedViewModes & (Kexi::ViewMode)mode) {
                GUIClient *instanceGuiClient = new GUIClient(
                    this, true, Kexi::nameForViewMode((Kexi::ViewMode)mode).toLatin1());
                d->instanceGuiClients.insert((Kexi::ViewMode)mode, instanceGuiClient);
            }
        }
        // also add an instance common for all modes (mode==0)
        GUIClient *instanceGuiClient = new GUIClient(this, true, "allViews");
        d->instanceGuiClients.insert(Kexi::AllViewModes, instanceGuiClient);

//todo
        initPartActions();
//  initActions();
    }
}
예제 #6
0
void KGlobalShortcutTest::testNotification()
{
    setupTest("testNotification");

    // Action without action collection
    KAction *action = new KAction("Text For Action A", this);
    QVERIFY(action->d->componentData == KGlobal::mainComponent());
    action->setObjectName("Action A");
    KShortcut cutB;
    action->setGlobalShortcut(cutB, KAction::ActiveShortcut, KAction::NoAutoloading);
    QVERIFY(action->d->componentData == KGlobal::mainComponent());

    // kglobalacceld collects registrations and shows the together. Give it
    // time to kick in.
    sleep(2);

    action->forgetGlobalShortcut();
}
예제 #7
0
void KonqPopupMenuPrivate::init(KonqPopupMenu::Flags kpf, KParts::BrowserExtension::PopupFlags flags)
{
    m_itemFlags = flags;
    q->setFont(KGlobalSettings::menuFont());

    Q_ASSERT(m_popupItemProperties.items().count() >= 1);

    bool bTrashIncluded = false;

    const KFileItemList lstItems = m_popupItemProperties.items();
    KFileItemList::const_iterator it = lstItems.constBegin();
    const KFileItemList::const_iterator kend = lstItems.constEnd();
    for ( ; it != kend; ++it )
    {
        const KUrl url = (*it).url();
        if ( !bTrashIncluded && (
             ( url.protocol() == "trash" && url.path().length() <= 1 ) ) ) {
            bTrashIncluded = true;
        }
    }

    const bool isDirectory = m_popupItemProperties.isDirectory();
    const bool sReading = m_popupItemProperties.supportsReading();
    bool sDeleting = (m_itemFlags & KParts::BrowserExtension::NoDeletion) == 0
                     && m_popupItemProperties.supportsDeleting();
    const bool sWriting = m_popupItemProperties.supportsWriting();
    const bool sMoving = sDeleting && m_popupItemProperties.supportsMoving();
    const bool isLocal = m_popupItemProperties.isLocal();

    KUrl url = m_sViewURL;
    url.cleanPath();

    bool isTrashLink     = false;
    bool isCurrentTrash = false;
    bool currentDir     = false;
    bool isSymLink = false;
    bool isSymLinkInSameDir = false; // true for "ln -s foo bar", false for links to foo/sub or /foo

    //check if url is current directory
    if ( lstItems.count() == 1 )
    {
        KFileItem firstPopupItem( lstItems.first() );
        if (firstPopupItem.isLink()) {
            isSymLink = true;
            isSymLinkInSameDir = !firstPopupItem.linkDest().contains('/');
        }
        KUrl firstPopupURL( firstPopupItem.url() );
        firstPopupURL.cleanPath();
        //kDebug(1203) << "View path is " << url.url();
        //kDebug(1203) << "First popup path is " << firstPopupURL.url();
        currentDir = firstPopupURL.equals( url, KUrl::CompareWithoutTrailingSlash );
        if ( firstPopupItem.isDesktopFile() ) {
            KDesktopFile desktopFile( firstPopupItem.localPath() );
            const KConfigGroup cfg = desktopFile.desktopGroup();
            isTrashLink = ( cfg.readEntry("Type") == "Link" && cfg.readEntry("URL") == "trash:/" );
        }

        if (isTrashLink) {
            sDeleting = false;
        }

        // isCurrentTrash: popup on trash:/ itself, or on the trash.desktop link
        isCurrentTrash = (firstPopupURL.protocol() == "trash" && firstPopupURL.path().length() <= 1)
                         || isTrashLink;
    }

    const bool isIntoTrash = (url.protocol() == "trash") && !isCurrentTrash; // trashed file, not trash:/ itself

    const bool bIsLink  = (m_itemFlags & KParts::BrowserExtension::IsLink);

    //kDebug() << "isLocal=" << isLocal << " url=" << url << " isCurrentTrash=" << isCurrentTrash << " isIntoTrash=" << isIntoTrash << " bTrashIncluded=" << bTrashIncluded;

    //////////////////////////////////////////////////////////////////////////

    addGroup( "topactions" ); // used e.g. for ShowMenuBar. includes a separator at the end

    KAction * act;

    KAction *actNewWindow = 0;

#if 0 // TODO in the desktop code itself.
    if (( flags & KParts::BrowserExtension::ShowProperties ) && isOnDesktop &&
        !KAuthorized::authorizeKAction("editable_desktop_icons"))
    {
        flags &= ~KParts::BrowserExtension::ShowProperties; // remove flag
    }
#endif

    // Either 'newview' is in the actions we're given (probably in the tabhandling group)
    // or we need to insert it ourselves (e.g. for the desktop).
    // In the first case, actNewWindow must remain 0.
    if ( ((kpf & KonqPopupMenu::ShowNewWindow) != 0) && sReading )
    {
        const QString openStr = i18n("&Open");
        actNewWindow = new KAction(m_parentWidget /*for status tips*/);
        m_ownActions.append(actNewWindow);
        actNewWindow->setIcon( KIcon("window-new") );
        actNewWindow->setText( openStr );
        QObject::connect(actNewWindow, SIGNAL(triggered()), q, SLOT(slotPopupNewView()));
    }

    if ( isDirectory && sWriting && !isCurrentTrash ) // A dir, and we can create things into it
    {
        const bool mkdirRequested = m_itemFlags & KParts::BrowserExtension::ShowCreateDirectory;
        if ( (currentDir || mkdirRequested) && m_pMenuNew ) // Current dir -> add the "new" menu
        {
            // As requested by KNewFileMenu :
            m_pMenuNew->checkUpToDate();
            m_pMenuNew->setPopupFiles(m_popupItemProperties.urlList());

            q->addAction( m_pMenuNew );
            q->addSeparator();
        }
        else if (mkdirRequested)
        {
            KAction *actNewDir = new KAction(m_parentWidget);
            m_ownActions.append(actNewDir);
            actNewDir->setIcon( KIcon("folder-new") );
            actNewDir->setText( i18n( "Create &Folder..." ) );
            QObject::connect(actNewDir, SIGNAL(triggered()), q, SLOT(slotPopupNewDir()));
            q->addAction( actNewDir );
            q->addSeparator();
        }
    } else if ( isIntoTrash ) {
        // Trashed item, offer restoring
        act = new KAction(m_parentWidget /*for status tips*/);
        m_ownActions.append(act);
        act->setText( i18n( "&Restore" ) );
        act->setHelpText(i18n("Restores this file or directory, back to the location where it was deleted from initially"));
        QObject::connect(act, SIGNAL(triggered()), q, SLOT(slotPopupRestoreTrashedItems()));
        q->addAction(act);
    }

    if (m_itemFlags & KParts::BrowserExtension::ShowNavigationItems)
    {
        if (m_itemFlags & KParts::BrowserExtension::ShowUp)
            addNamedAction( "go_up" );
        addNamedAction( "go_back" );
        addNamedAction( "go_forward" );
        if (m_itemFlags & KParts::BrowserExtension::ShowReload)
            addNamedAction( "reload" );
        q->addSeparator();
    }

    if (!currentDir && isSymLink && !isSymLinkInSameDir) {
        // #65151: offer to open the target's parent dir
        act = new KAction(m_parentWidget);
        m_ownActions.append(act);
        act->setText(isDirectory ? i18n("Show Original Directory") : i18n("Show Original File"));
        act->setHelpText(i18n("Opens a new file manager window showing the target of this link, in its parent directory."));
        QObject::connect(act, SIGNAL(triggered()), q, SLOT(slotShowOriginalFile()));
        q->addAction(act);
    }

    // "open in new window" is either provided by us, or by the tabhandling group
    if (actNewWindow) {
        q->addAction(actNewWindow);
        q->addSeparator();
    }
    addGroup( "tabhandling" ); // includes a separator at the end

    if (m_itemFlags & KParts::BrowserExtension::ShowUrlOperations) {
        if ( !currentDir && sReading ) {
            if ( sDeleting ) {
                addNamedAction( "cut" );
            }
            addNamedAction( "copy" );
        }

        if ( isDirectory && sWriting ) {
            if ( currentDir )
                addNamedAction( "paste" );
            else
                addNamedAction( "pasteto" );
        }
    }
    if ( isCurrentTrash )
    {
        act = new KAction(m_parentWidget);
        m_ownActions.append(act);
        act->setIcon( KIcon("trash-empty") );
        act->setText( i18n( "&Empty Trash Bin" ) );
        KConfig trashConfig( "trashrc", KConfig::SimpleConfig);
        act->setEnabled( !trashConfig.group("Status").readEntry( "Empty", true ) );
        QObject::connect(act, SIGNAL(triggered()), q, SLOT(slotPopupEmptyTrashBin()));
        q->addAction(act);
    }
    if ( isCurrentTrash )
    {
	act = new KAction(m_parentWidget);
	m_ownActions.append(act);
	act->setIcon( KIcon("trash-empty") );
	act->setText( i18n( "&Configure Trash Bin" ) );
	QObject::connect(act, SIGNAL(triggered()), q, SLOT(slotConfigTrashBin()));
	q->addAction(act);
    }

    // This is used by KHTML, see khtml_popupmenu.rc (copy, selectAll, searchProvider etc.)
    // and by DolphinPart (rename, trash, delete)
    addGroup( "editactions" );

    if (m_itemFlags & KParts::BrowserExtension::ShowTextSelectionItems) {
        // OK, we have to stop here.

        // Anything else that is provided by the part
        addGroup( "partactions" );
        return;
    }

    if ( !isCurrentTrash && !isIntoTrash && (m_itemFlags & KParts::BrowserExtension::ShowBookmark))
    {
        QString caption;
        if (currentDir)
        {
           const bool httpPage = m_sViewURL.protocol().startsWith("http", Qt::CaseInsensitive);
           if (httpPage)
              caption = i18n("&Bookmark This Page");
           else
              caption = i18n("&Bookmark This Location");
        }
        else if (isDirectory)
           caption = i18n("&Bookmark This Folder");
        else if (bIsLink)
           caption = i18n("&Bookmark This Link");
        else
           caption = i18n("&Bookmark This File");

        act = new KAction(m_parentWidget);
        m_ownActions.append(act);
        act->setObjectName( QLatin1String("bookmark_add" )); // for unittest
        act->setIcon( KIcon("bookmark-new") );
        act->setText( caption );
        QObject::connect(act, SIGNAL(triggered()), q, SLOT(slotPopupAddToBookmark()));
        if (lstItems.count() > 1)
            act->setEnabled(false);
        if (KAuthorized::authorizeKAction("bookmarks"))
            q->addAction( act );
        if (bIsLink)
            addGroup( "linkactions" ); // see khtml
    }

    // "Open With" actions

    m_menuActions.setItemListProperties(m_popupItemProperties);

    if ( sReading ) {
        m_menuActions.addOpenWithActionsTo(q, "DesktopEntryName != 'kfmclient' and DesktopEntryName != 'kfmclient_dir' and DesktopEntryName != 'kfmclient_html'");

        QList<QAction *> previewActions = m_actionGroups.value("preview");
        if (!previewActions.isEmpty()) {
            if (previewActions.count() == 1) {
                q->addAction(previewActions.first());
            } else {
                QMenu* subMenu = new QMenu(i18n("Preview In"), q);
                subMenu->menuAction()->setObjectName( QLatin1String("preview_submenu" )); // for the unittest
                q->addMenu(subMenu);
                subMenu->addActions(previewActions);
            }
        }
    }

    // Second block, builtin + user
    m_menuActions.addServiceActionsTo(q);

    q->addSeparator();

    // Use the Dolphin setting for showing the "Copy To" and "Move To" actions
    KSharedConfig::Ptr dolphin = KSharedConfig::openConfig("dolphinrc");

    // CopyTo/MoveTo menus
    if (m_itemFlags & KParts::BrowserExtension::ShowUrlOperations &&
        KConfigGroup(dolphin, "General").readEntry("ShowCopyMoveMenu", false)) {

        m_copyToMenu.setItems(lstItems);
        m_copyToMenu.setReadOnly(sMoving == false);
        m_copyToMenu.addActionsTo(q);
        q->addSeparator();
    }

    if (!isCurrentTrash && !isIntoTrash && sReading &&
        (kpf & KonqPopupMenu::NoPlugins) == 0) {
        addPlugins(); // now it's time to add plugins
    }

    if ( (m_itemFlags & KParts::BrowserExtension::ShowProperties) && KPropertiesDialog::canDisplay( lstItems ) ) {
        act = new KAction(m_parentWidget);
        m_ownActions.append(act);
        act->setObjectName( QLatin1String("properties" )); // for unittest
        act->setText( i18n( "&Properties" ) );
        QObject::connect(act, SIGNAL(triggered()), q, SLOT(slotPopupProperties()));
        q->addAction(act);
    }

    while ( !q->actions().isEmpty() &&
            q->actions().last()->isSeparator() )
        delete q->actions().last();

    if ( isDirectory && isLocal ) {
        if ( KFileShare::authorization() == KFileShare::Authorized ) {
            q->addSeparator();
            act = new KAction(m_parentWidget);
            m_ownActions.append(act);
            act->setText( i18n("Share") );
            QObject::connect(act, SIGNAL(triggered()), q, SLOT(slotOpenShareFileDialog()));
            q->addAction(act);
        }
    }

    // Anything else that is provided by the part
    addGroup( "partactions" );
}
예제 #8
0
void TokenWithLayout::fillMenu( QMenu * menu )
{
    DEBUG_BLOCK
    KAction *boldAction = new KAction( KIcon( "format-text-bold"), i18n( "Bold" ), menu );
    boldAction->setObjectName( ActionBoldName );
    boldAction->setCheckable( true );
    boldAction->setChecked( m_bold );

    KAction *italicAction = new KAction( KIcon( "format-text-italic"), i18n( "Italic" ), menu );
    italicAction->setObjectName( ActionItalicName );
    italicAction->setCheckable( true );
    italicAction->setChecked( m_italic );

    KAction *alignLeftAction = new KAction( KIcon( "format-justify-left"), i18n( "Left" ), menu );
    KAction *alignCenterAction = new KAction( KIcon( "format-justify-center"), i18n( "Center" ), menu );
    KAction *alignRightAction = new KAction( KIcon( "format-justify-right"), i18n( "Right" ), menu );
    alignLeftAction->setObjectName( ActionAlignLeftName );
    alignLeftAction->setCheckable( true );
    alignCenterAction->setObjectName( ActionAlignCenterName );
    alignCenterAction->setCheckable( true );
    alignRightAction->setObjectName( ActionAlignRightName );
    alignRightAction->setCheckable( true );

    if ( m_alignment & Qt::AlignLeft )
        alignLeftAction->setChecked( true );
    else if ( m_alignment & Qt::AlignHCenter )
        alignCenterAction->setChecked( true );
    else if ( m_alignment & Qt::AlignRight )
        alignRightAction->setChecked( true );

    QActionGroup *alignmentGroup = new QActionGroup( menu );
    alignmentGroup->addAction( alignLeftAction );
    alignmentGroup->addAction( alignCenterAction );
    alignmentGroup->addAction( alignRightAction );

    menu->addAction( boldAction );
    menu->addAction( italicAction );
    menu->addSeparator()->setText( i18n( "Alignment" ) );
    menu->addAction( alignLeftAction );
    menu->addAction( alignCenterAction );
    menu->addAction( alignRightAction );
    menu->addSeparator()->setText( i18n( "Width" ) );
    menu->adjustSize();

    int orgHeight = menu->height();

    KHBox * sliderBox = new KHBox( menu );
    sliderBox->setFixedWidth( menu->width() - 4 );
    sliderBox->move( sliderBox->pos().x() + 2, orgHeight );

    QSlider * slider = new QSlider( Qt::Horizontal, sliderBox );
    slider->setMaximum( 100 );
    slider->setMinimum( 0 );

    // this should really not be done here as it makes upward assumptions
    // it was however done in setWidth with similar upward assumptions as well
    // solution: the popup stuff -iff- should be done in the dialog or the editWidget
    if ( parentWidget() )
    {
        if ( TokenDropTarget *editWidget = qobject_cast<TokenDropTarget*>( parentWidget() ) )
        {
            qreal spareWidth = 100.0;
            int row = editWidget->row( this );
            if ( row > -1 )
            {
                QList<Token*> tokens = editWidget->drags( row );
                foreach (Token *t, tokens)
                {
                    if (t == this)
                        continue;
                    if ( TokenWithLayout *twl = qobject_cast<TokenWithLayout*>( t ) )
                        spareWidth -= twl->width() * 100.0;
                }
            }

            int max = qMax( spareWidth, 0.0 );
            debug() << "slider max value: " << max;

            if ( max >= m_width * 100.0 )
                slider->setMaximum( qMax( spareWidth, 0.0 ) );
            else
                slider->setMaximum( m_width * 100.0 );
        }