Esempio n. 1
0
void AbstractClient::setOnAllDesktops(bool b)
{
    if ((b && isOnAllDesktops()) ||
            (!b && !isOnAllDesktops()))
        return;
    if (b)
        setDesktop(NET::OnAllDesktops);
    else
        setDesktop(VirtualDesktopManager::self()->current());
}
Esempio n. 2
0
void KCommonDecoration::desktopChange()
{
    if ( m_button[OnAllDesktopsButton] ) {
        m_button[OnAllDesktopsButton]->setOn( isOnAllDesktops() );
        m_button[OnAllDesktopsButton]->setTipText( isOnAllDesktops() ?
                i18n("Not on all desktops")
            : i18n("On all desktops"));
        m_button[OnAllDesktopsButton]->reset(KCommonDecorationButton::StateChange);
    }
}
Esempio n. 3
0
void Client::startupIdChanged()
    {
    TDEStartupInfoId asn_id;
    TDEStartupInfoData asn_data;
    bool asn_valid = workspace()->checkStartupNotification( window(), asn_id, asn_data );
    if( !asn_valid )
        return;
    // If the ASN contains desktop, move it to the desktop, otherwise move it to the current
    // desktop (since the new ASN should make the window act like if it's a new application
    // launched). However don't affect the window's desktop if it's set to be on all desktops.
    int desktop = workspace()->currentDesktop();
    if( asn_data.desktop() != 0 )
        desktop = asn_data.desktop();
    if( !isOnAllDesktops())
        workspace()->sendClientToDesktop( this, desktop, true );
    if( asn_data.xinerama() != -1 )
        workspace()->sendClientToScreen( this, asn_data.xinerama());
    Time timestamp = asn_id.timestamp();
    if( timestamp == 0 && asn_data.timestamp() != -1U )
        timestamp = asn_data.timestamp();
    if( timestamp != 0 )
        {
        bool activate = workspace()->allowClientActivation( this, timestamp );
        if( asn_data.desktop() != 0 && !isOnCurrentDesktop())
            activate = false; // it was started on different desktop than current one
        if( activate )
            workspace()->activateClient( this );
        else
            demandAttention();
        }
    }
Esempio n. 4
0
void KDecoration::toggleOnAllDesktops()
{
    if(isOnAllDesktops())
        setDesktop(bridge_->currentDesktop());
    else
        setDesktop(NET::OnAllDesktops);
}
Esempio n. 5
0
void KWMThemeClient::desktopChange()
{
    if (stickyBtn) {
       bool on = isOnAllDesktops();
       stickyBtn->setPixmap(on ? *pindownPix : *pinupPix);
       QToolTip::remove( stickyBtn );
       QToolTip::add( stickyBtn, on ? i18n("Unsticky") : i18n("Sticky") );
    }
}
Esempio n. 6
0
void NextClient::desktopChange()
{
    bool on = isOnAllDesktops();
    if (NextButton * b = button[STICKY_IDX]) {
        b->setBitmap( on ? unsticky_bits : sticky_bits, 10, 10);
	QToolTip::remove(b);
	QToolTip::add(b, on ? i18n("Not on all desktops") : i18n("On all desktops"));
    }
}
Esempio n. 7
0
QString Task::description() const {
	QString temp;
	switch (type()) {
	case StartupItem:
		temp = i18n("Starting application...");
		break;
	case TaskItem:
	case GroupItem:
		temp = isOnAllDesktops() ?
			i18n("On all desktops") :
			i18nc("Which virtual desktop a window is currently on", "On %1",
				KWindowSystem::desktopName(m_abstractItem->desktop()));
		break;
	case LauncherItem:
		temp = launcherItem()->genericName();
		break;
	case OtherItem:
		break;
	}
	return temp;
}
Esempio n. 8
0
void Manager::createTitle()
{
   leftButtonList_.clear();
   rightButtonList_.clear();

   TQString buttons;

   if (options()->customButtonPositions())
      buttons = options()->titleButtonsLeft() + "|" +
                options()->titleButtonsRight();
   else
      buttons = "XSH|IA";

   TQPtrList<Button> *buttonList = &leftButtonList_;

   for (unsigned int i = 0; i < buttons.length(); ++i)
   {
      Button * tb = NULL;

      switch (buttons[i].latin1())
      {
         case 'S': // Sticky
            tb = new StickyButton(widget());
            connect(this, TQT_SIGNAL(stickyChanged(bool)),
                    tb, TQT_SLOT(setOn(bool)));
            connect(tb, TQT_SIGNAL(toggleSticky()), this, TQT_SLOT(slotToggleSticky()));
            emit(stickyChanged(isOnAllDesktops()));
            break;

         case 'H': // Help
            if (providesContextHelp())
            {
               tb = new HelpButton(widget());
               connect(tb, TQT_SIGNAL(help()), this, TQT_SLOT(showContextHelp()));
            }
            break;

         case 'I': // Minimize
            if (isMinimizable())
            {
               tb = new IconifyButton(widget());
               connect(tb, TQT_SIGNAL(iconify()), this, TQT_SLOT(minimize()));
            }
            break;

         case 'A': // Maximize
            if (isMaximizable())
            {
               tb = new MaximiseButton(widget());
               connect(tb, TQT_SIGNAL(maximizeClicked(ButtonState)),
                       this, TQT_SLOT(slotMaximizeClicked(ButtonState)));
               connect(this, TQT_SIGNAL(maximizeChanged(bool)),
                       tb, TQT_SLOT(setOn(bool)));
               emit(maximizeChanged(maximizeMode() == MaximizeFull));
            }
            break;

         case 'F': // Above
            tb = new AboveButton(widget());
            connect(tb, TQT_SIGNAL(above()), this, TQT_SLOT(slotAbove()));
            break;

         case 'B': // Lower
            tb = new LowerButton(widget());
            connect(tb, TQT_SIGNAL(lower()), this, TQT_SLOT(slotLower()));
            break;

         case 'X': // Close
            if (isCloseable())
            {
               tb = new CloseButton(widget());
               connect(tb, TQT_SIGNAL(closeWindow()), this, TQT_SLOT(closeWindow()));
            }
            break;

         case '|':
            buttonList = &rightButtonList_;
            break;
      }

      if (tb != NULL)
      {
         connect(this, TQT_SIGNAL(activeChanged(bool)), tb, TQT_SLOT(setActive(bool)));
         buttonList->append(tb);
      }
   }
Esempio n. 9
0
void Manager::slotToggleSticky()
{
   toggleOnAllDesktops();
   emit(stickyChanged(isOnAllDesktops()));
}
Esempio n. 10
0
void KCommonDecoration::addButtons(ButtonContainer &btnContainer, const QString& s, bool isLeft)
{
    if (s.length() > 0) {
        for (unsigned n=0; n < s.length(); n++) {
            KCommonDecorationButton *btn = 0;
            switch (s[n]) {
              case 'M': // Menu button
                  if (!m_button[MenuButton]){
                      btn = createButton(MenuButton);
                      if (!btn) break;
                      btn->setTipText(i18n("Menu") );
                      btn->setRealizeButtons(LeftButton|RightButton);
                      connect(btn, SIGNAL(pressed()), SLOT(menuButtonPressed()));
                      connect(btn, SIGNAL(released()), this, SLOT(menuButtonReleased()));

                      m_button[MenuButton] = btn;
                  }
                  break;
              case 'S': // OnAllDesktops button
                  if (!m_button[OnAllDesktopsButton]){
                      btn = createButton(OnAllDesktopsButton);
                      if (!btn) break;
                      const bool oad = isOnAllDesktops();
                      btn->setTipText(oad?i18n("Not on all desktops"):i18n("On all desktops") );
                      btn->setToggleButton(true);
                      btn->setOn( oad );
                      connect(btn, SIGNAL(clicked()), SLOT(toggleOnAllDesktops()));

                      m_button[OnAllDesktopsButton] = btn;
                  }
                  break;
              case 'H': // Help button
                  if ((!m_button[HelpButton]) && providesContextHelp()){
                      btn = createButton(HelpButton);
                      if (!btn) break;
                      btn->setTipText(i18n("Help") );
                      connect(btn, SIGNAL(clicked()), SLOT(showContextHelp()));

                      m_button[HelpButton] = btn;
                  }
                  break;
              case 'I': // Minimize button
                  if ((!m_button[MinButton]) && isMinimizable()){
                      btn = createButton(MinButton);
                      if (!btn) break;
                      btn->setTipText(i18n("Minimize") );
                      connect(btn, SIGNAL(clicked()), SLOT(minimize()));

                      m_button[MinButton] = btn;
                  }
                  break;
              case 'A': // Maximize button
                  if ((!m_button[MaxButton]) && isMaximizable()){
                      btn = createButton(MaxButton);
                      if (!btn) break;
                      btn->setRealizeButtons(LeftButton|MidButton|RightButton);
                      const bool max = maximizeMode()==MaximizeFull;
                      btn->setTipText(max?i18n("Restore"):i18n("Maximize") );
                      btn->setToggleButton(true);
                      btn->setOn( max );
                      connect(btn, SIGNAL(clicked()), SLOT(slotMaximize()));

                      m_button[MaxButton] = btn;
                  }
                  break;
              case 'X': // Close button
                  if ((!m_button[CloseButton]) && isCloseable()){
                      btn = createButton(CloseButton);
                      if (!btn) break;
                      btn->setTipText(i18n("Close") );
                      connect(btn, SIGNAL(clicked()), SLOT(closeWindow()));

                      m_button[CloseButton] = btn;
                  }
                  break;
              case 'F': // AboveButton button
                  if (!m_button[AboveButton]){
                      btn = createButton(AboveButton);
                      if (!btn) break;
                      bool above = keepAbove();
                      btn->setTipText(above?i18n("Do not keep above others"):i18n("Keep above others") );
                      btn->setToggleButton(true);
                      btn->setOn( above );
                      connect(btn, SIGNAL(clicked()), SLOT(slotKeepAbove()));

                      m_button[AboveButton] = btn;
                  }
                  break;
              case 'B': // BelowButton button
                  if (!m_button[BelowButton]){
                      btn = createButton(BelowButton);
                      if (!btn) break;
                      bool below = keepBelow();
                      btn->setTipText(below?i18n("Do not keep below others"):i18n("Keep below others") );
                      btn->setToggleButton(true);
                      btn->setOn( below );
                      connect(btn, SIGNAL(clicked()), SLOT(slotKeepBelow()));

                      m_button[BelowButton] = btn;
                  }
                  break;
              case 'L': // Shade button
                  if ((!m_button[ShadeButton]) && isShadeable()){
                      btn = createButton(ShadeButton);
                      if (!btn) break;
                      bool shaded = isSetShade();
                      btn->setTipText(shaded?i18n("Unshade"):i18n("Shade") );
                      btn->setToggleButton(true);
                      btn->setOn( shaded );
                      connect(btn, SIGNAL(clicked()), SLOT(slotShade()));

                      m_button[ShadeButton] = btn;
                  }
                  break;
              case '_': // Spacer item
                  btnContainer.append(0);
            }


            if (btn) {
                btn->setLeft(isLeft);
                btn->setSize(QSize(layoutMetric(LM_ButtonWidth, true, btn),layoutMetric(LM_ButtonHeight, true, btn)) );
                btn->show();
                btnContainer.append(btn);
            }

        }
    }
}
Esempio n. 11
0
void PreviewClient::requestToggleOnAllDesktops()
{
    setDesktop(isOnAllDesktops() ? 1 : -1);
}