示例#1
0
void MenuMedia::mediaInsertItem(KFileItem *fileItem)
{
	// reset the mMenuId Int after 100 because I don't want to see what happens
	// when the int gets too big
	if (mMenuId > 100)
		mMenuId = 0;

	//find a valid mMenuId first
	int count = 0;
	while ((m_MenuItemMap.contains(mMenuId) == true))
	{
		if (count >= 500)
		{
			kdFatal() << "Infinite Loop found, report this please" << endl;
		}
		count++;
		mMenuId++;
	}

	if (KickerSettings::menuEntryHeight() > -1)
	{
		insertItem( SmallIconSet( fileItem->iconName(),
		                          KickerSettings::menuEntryHeight()),
		            fileItem->name(),
		            mMenuId);
	}
	else
	{
		insertItem(fileItem->name(), mMenuId);
	}
	m_MenuItemMap[mMenuId] = QString(fileItem->url().url());
	mMenuId++;
}
示例#2
0
QPopupMenu* KDiffTextEdit::createPopupMenu( const QPoint& p )
{
  QPopupMenu* popup = QTextEdit::createPopupMenu( p );
  if ( !popup )
    popup = new QPopupMenu( this );

  int i = 0;

  for ( QStringList::Iterator it = extPartsTranslated.begin(); it != extPartsTranslated.end(); ++it ) {
    popup->insertItem( i18n( "Show in %1" ).arg( *it ), i + POPUP_BASE, i );
    i++;
  }
  if ( !extPartsTranslated.isEmpty() )
    popup->insertSeparator( i );
  connect( popup, SIGNAL(activated(int)), this, SLOT(popupActivated(int)) );

  popup->insertItem( SmallIconSet( "filesaveas" ), i18n( "&Save As..." ), this, SLOT(saveAs()), CTRL + Key_S, POPUP_BASE - 2, 0 );
  popup->setItemEnabled( POPUP_BASE - 2, length() > 0 );

  popup->insertSeparator( 1 );

  popup->insertItem( i18n( "Highlight Syntax" ), this, SLOT(toggleSyntaxHighlight()), 0, POPUP_BASE - 1, 2 );
  popup->setItemChecked( POPUP_BASE - 1, _highlight );
  popup->insertSeparator( 3 );

  popup->insertSeparator();
  popup->insertItem( i18n("Hide view"), parent(), SLOT(hideView()) );

  return popup;
}
示例#3
0
void PanelKMenu::slotPopulateSessions()
{
    int p = 0;
    DM dm;

    sessionsMenu->clear();
    if (kapp->authorize("start_new_session") && (p = dm.numReserve()) >= 0)
    {
        if (kapp->authorize("lock_screen"))
	  sessionsMenu->insertItem(/*SmallIconSet("lockfork"),*/ i18n("Lock Current && Start New Session"), 100 );
        sessionsMenu->insertItem(SmallIconSet("fork"), i18n("Start New Session"), 101 );
        if (!p) {
            sessionsMenu->setItemEnabled( 100, false );
            sessionsMenu->setItemEnabled( 101, false );
        }
        sessionsMenu->insertSeparator();
    }
    SessList sess;
    if (dm.localSessions( sess ))
        for (SessList::ConstIterator it = sess.begin(); it != sess.end(); ++it) {
            int id = sessionsMenu->insertItem( DM::sess2Str( *it ), (*it).vt );
            if (!(*it).vt)
                sessionsMenu->setItemEnabled( id, false );
            if ((*it).self)
                sessionsMenu->setItemChecked( id, true );
        }
}
示例#4
0
ProcAttachPS::ProcAttachPS(QWidget* parent) :
	ProcAttachBase(parent),
	m_pidCol(-1),
	m_ppidCol(-1)
{
    m_ps = new KProcess;
    connect(m_ps, SIGNAL(receivedStdout(KProcess*, char*, int)),
	    this, SLOT(slotTextReceived(KProcess*, char*, int)));
    connect(m_ps, SIGNAL(processExited(KProcess*)),
	    this, SLOT(slotPSDone()));

    QIconSet icon = SmallIconSet("clear_left");
    filterClear->setIconSet(icon);

    processList->setColumnWidth(0, 300);
    processList->setColumnWidthMode(0, QListView::Manual);
    processList->setColumnAlignment(1, Qt::AlignRight);
    processList->setColumnAlignment(2, Qt::AlignRight);

    // set the command line
    static const char* const psCommand[] = {
#ifdef PS_COMMAND
	PS_COMMAND,
#else
	"/bin/false",
#endif
	0
    };
    for (int i = 0; psCommand[i] != 0; i++) {
	*m_ps << psCommand[i];
    }

    runPS();
}
示例#5
0
void KPrintAction::slotAboutToShow()
{
	popupMenu()->clear();
	d->printers.clear();
	QPtrList<KMPrinter>	*prts = KMManager::self()->printerList();
	if (prts && !prts->isEmpty())
	{
		QPtrListIterator<KMPrinter>	it(*prts);
		bool	first(false);
		int	ID(0);
		for (; it.current(); ++it)
		{
			if (d->type == All || (d->type == Specials && it.current()->isSpecial()) || (d->type == Regular && !it.current()->isSpecial()))
			{
				if (d->type == All && !first && it.current()->isSpecial())
				{
					if (popupMenu()->count() > 0)
						popupMenu()->insertSeparator();
					first = true;
				}
				popupMenu()->insertItem(SmallIconSet(it.current()->pixmap()), it.current()->name(), ID++);
				d->printers.append(it.current()->name());
			}
		}
	}
}
示例#6
0
bool
StdWidgetFactory::createMenuActions(const QCString &classname, QWidget *, QPopupMenu *menu,
	KFormDesigner::Container *)
{
	if((classname == "QLabel") || (classname == "KTextEdit"))
	{
		menu->insertItem(SmallIconSet("edit"), i18n("Edit Rich Text"), this, SLOT(editText()));
		return true;
	}
	else if(classname == "KListView")
	{
		menu->insertItem(SmallIconSet("edit"), i18n("Edit Listview Contents"), this, SLOT(editListContents()));
		return true;
	}

	return false;
}
示例#7
0
QPopupMenu *KEdit::createPopupMenu(const QPoint &pos)
{
    enum
    {
        IdUndo,
        IdRedo,
        IdSep1,
        IdCut,
        IdCopy,
        IdPaste,
        IdClear,
        IdSep2,
        IdSelectAll
    };

    QPopupMenu *menu = QMultiLineEdit::createPopupMenu(pos);

    if(isReadOnly())
        menu->changeItem(menu->idAt(0), SmallIconSet("editcopy"), menu->text(menu->idAt(0)));
    else
    {
        int id = menu->idAt(0);
        menu->changeItem(id - IdUndo, SmallIconSet("undo"), menu->text(id - IdUndo));
        menu->changeItem(id - IdRedo, SmallIconSet("redo"), menu->text(id - IdRedo));
        menu->changeItem(id - IdCut, SmallIconSet("editcut"), menu->text(id - IdCut));
        menu->changeItem(id - IdCopy, SmallIconSet("editcopy"), menu->text(id - IdCopy));
        menu->changeItem(id - IdPaste, SmallIconSet("editpaste"), menu->text(id - IdPaste));
        menu->changeItem(id - IdClear, SmallIconSet("editclear"), menu->text(id - IdClear));
    }

    return menu;
}
示例#8
0
ModuleWidget::ModuleWidget(QWidget *parent, const char *name) : QVBox(parent, name)
{
    QHBox *titleLine = new QHBox(this, "titleLine");
    m_title = new ModuleTitle(titleLine, "m_title");
    QPushButton *helpButton = new QPushButton(titleLine);
    helpButton->setIconSet(SmallIconSet("help"));
    connect(helpButton, SIGNAL(clicked()), this, SIGNAL(helpRequest()));
    m_body = new QVBox(this, "m_body");
    setStretchFactor(m_body, 10);
}
示例#9
0
void propertySetter::addButton(){

  m_pb = new KPushButton(this);
  QToolTip::add(m_pb, i18n( "More..." ));
  QIconSet iconSet = SmallIconSet(QString::fromLatin1("2rightarrow"));
  QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal );
  m_pb->setIconSet(iconSet);
  m_pb->setFixedSize( pixMap.width()+8, pixMap.height()+8 );
  m_pb->hide();
  connect(m_pb, SIGNAL(clicked()), this ,SLOT(Show()));
}
示例#10
0
// update the session list and rebuild the menu
void KateSessionMenu::initialize()
{
  if ( initialized() )
  {
    return;
  }

  m_sessions.clear();

  int id = 0;

  // no session - exec 'kate'
  insertItem( SmallIconSet("kate"), i18n("Start Kate (no arguments)"), id++ );

  // new session - prompt for a name and  exec 'kate --start NAME'
  insertItem( SmallIconSet("new"), i18n("New Kate Session"), id++ );

  // new anonymous session, 'kate --start ""'
  insertItem( SmallIconSet("new"), i18n("New Anonymous Session"), id++ );

  insertSeparator();

  QStringList list = KGlobal::dirs()->findAllResources( "data", "kate/sessions/*.katesession", false, true);
  for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
  {
    KSimpleConfig config( *it, true );
    config.setGroup( "General" );
    m_sessions.append( config.readEntry( "Name" ) );
  }

  m_sessions.sort();

  for ( QStringList::ConstIterator it1 = m_sessions.begin(); it1 != m_sessions.end(); ++it1 )
  {
    insertItem( *it1, id++ );
  }

  // means for updating, to let the user manually update if he/she added new sessions.
  insertSeparator();
  insertItem( SmallIconSet("reload"), i18n("Reload Session List"), this, SLOT(reinitialize()) );
}
示例#11
0
void KonqSidebarHistoryModule::slotClearHistory()
{
    KGuiItem guiitem = KStdGuiItem::clear();
    guiitem.setIconSet( SmallIconSet("history_clear"));

    if ( KMessageBox::warningContinueCancel( tree(),
				     i18n("Do you really want to clear "
					  "the entire history?"),
				     i18n("Clear History?"), guiitem )
	 == KMessageBox::Continue )
	KonqHistoryManager::kself()->emitClear();
}
示例#12
0
MessageOutput::MessageOutput(QWidget *parent, const char *name )
  : QListBox(parent,name)
{
  m_maxItems = 2000;

  QPalette pal = palette();
  pal.setColor(QColorGroup::HighlightedText, pal.color(QPalette::Normal, QColorGroup::Text));
  pal.setColor(QColorGroup::Highlight,       pal.color(QPalette::Normal, QColorGroup::Mid));
  setPalette(pal);
  setFocusPolicy( NoFocus );

  m_popupMenu = new KPopupMenu(this);
  connect(this, SIGNAL(contextMenuRequested(QListBoxItem*, const QPoint&)),
     this, SLOT(showMenu(QListBoxItem*, const QPoint&)));
  m_popupMenu->insertItem( SmallIconSet("editcopy"), i18n("&Copy"), this, SLOT(copyContent()) ) ;
  m_popupMenu->insertItem( SmallIconSet("filesaveas"), i18n("&Save As..."), this, SLOT(saveContent()) ) ;
  m_popupMenu->insertSeparator();
  m_popupMenu->insertItem( SmallIconSet("editclear"), i18n("Clear"), this, SLOT(clear()) ) ;

  connect( this, SIGNAL(clicked(QListBoxItem*)), SLOT(clickItem(QListBoxItem*)) );
}
示例#13
0
QPopupMenu *KLineEdit::createPopupMenu()
{
    enum { IdUndo, IdRedo, IdSep1, IdCut, IdCopy, IdPaste, IdClear, IdSep2, IdSelectAll };

    QPopupMenu *popup = QLineEdit::createPopupMenu();

      int id = popup->idAt(0);
      popup->changeItem( id - IdUndo, SmallIconSet("undo"), popup->text( id - IdUndo) );
      popup->changeItem( id - IdRedo, SmallIconSet("redo"), popup->text( id - IdRedo) );
      popup->changeItem( id - IdCut, SmallIconSet("editcut"), popup->text( id - IdCut) );
      popup->changeItem( id - IdCopy, SmallIconSet("editcopy"), popup->text( id - IdCopy) );
      popup->changeItem( id - IdPaste, SmallIconSet("editpaste"), popup->text( id - IdPaste) );
      popup->changeItem( id - IdClear, SmallIconSet("editclear"), popup->text( id - IdClear) );

    // If a completion object is present and the input
    // widget is not read-only, show the Text Completion
    // menu item.
    if ( compObj() && !isReadOnly() && kapp->authorize("lineedit_text_completion") )
    {
        QPopupMenu *subMenu = new QPopupMenu( popup );
        connect( subMenu, SIGNAL( activated( int ) ),
                 this, SLOT( completionMenuActivated( int ) ) );

        popup->insertSeparator();
        popup->insertItem( SmallIconSet("completion"), i18n("Text Completion"),
                           subMenu );

        subMenu->insertItem( i18n("None"), NoCompletion );
        subMenu->insertItem( i18n("Manual"), ShellCompletion );
        subMenu->insertItem( i18n("Automatic"), AutoCompletion );
        subMenu->insertItem( i18n("Dropdown List"), PopupCompletion );
        subMenu->insertItem( i18n("Short Automatic"), ShortAutoCompletion );
        subMenu->insertItem( i18n("Dropdown List && Automatic"), PopupAutoCompletion );

        subMenu->setAccel( KStdAccel::completion(), ShellCompletion );

        KGlobalSettings::Completion mode = completionMode();
        subMenu->setItemChecked( NoCompletion,
                                 mode == KGlobalSettings::CompletionNone );
        subMenu->setItemChecked( ShellCompletion,
                                 mode == KGlobalSettings::CompletionShell );
        subMenu->setItemChecked( PopupCompletion,
                                 mode == KGlobalSettings::CompletionPopup );
        subMenu->setItemChecked( AutoCompletion,
                                 mode == KGlobalSettings::CompletionAuto );
        subMenu->setItemChecked( ShortAutoCompletion,
                                 mode == KGlobalSettings::CompletionMan );
        subMenu->setItemChecked( PopupAutoCompletion,
                                 mode == KGlobalSettings::CompletionPopupAuto );
        if ( mode != KGlobalSettings::completionMode() )
        {
            subMenu->insertSeparator();
            subMenu->insertItem( i18n("Default"), Default );
        }
    }
示例#14
0
bool
KexiReportFactory::createMenuActions(const QCString &classname, QWidget *w, 
	QPopupMenu *menu,	KFormDesigner::Container *container)
{
	Q_UNUSED(w);
	Q_UNUSED(container);
	if(classname == "Label") {
		/*! @todo use KAction */
		menu->insertItem(SmallIconSet("edit"), i18n("Edit Rich Text"), this, SLOT(editText()));
		return true;
	}
	return false;
}
示例#15
0
BrowserBar::BrowserBar( QWidget *parent )
        : QWidget( parent, "BrowserBar" )
        , EngineObserver( EngineController::instance() )
        , m_playlistBox( new QVBox( this ) )
        , m_divider( new Amarok::Splitter( this ) )
        , m_browserBox( new QVBox( this ) )
        , m_currentIndex( -1 )
        , m_lastIndex( -1 )
        , m_mapper( new QSignalMapper( this ) )
{
    m_tabManagementButton = new QPushButton( SmallIconSet(Amarok::icon( "configure" )), 0, this, "tab_managment_button" );
    connect (m_tabManagementButton, SIGNAL(clicked()), SLOT(showBrowserSelectionMenu()));
    m_tabManagementButton->setIsMenuButton ( true ); //deprecated, but since I cannot add menu directly to button it is needed.

    QToolTip::add (m_tabManagementButton, i18n("Manage tabs")); 


    m_tabBar = new MultiTabBar( MultiTabBar::Vertical, this );


    m_tabManagementButton->setFixedWidth(m_tabBar->sizeHint().width());
    m_tabManagementButton->setFixedHeight(m_tabBar->sizeHint().width());


    s_instance = this;
    m_pos = m_tabBar->sizeHint().width() + 5; //5 = esthetic spacing

    m_tabBar->setStyle( MultiTabBar::AMAROK );
    m_tabBar->setPosition( MultiTabBar::Left );
    m_tabBar->showActiveTabTexts( true );
    m_tabBar->setFixedWidth( m_pos );
    m_tabBar->move( 0, 25 );

    QVBoxLayout *layout = new QVBoxLayout( m_browserBox );
    layout->addSpacing( 3 ); // aesthetics
    layout->setAutoAdd( true );

    m_browserBox->move( m_pos, 0 );
    m_browserBox->hide();
    m_divider->hide();
    m_playlistBox->setSpacing( 1 );

    connect( m_mapper, SIGNAL(mapped( int )), SLOT(showHideBrowser( int )) );

 


   
    //m_tabBar->appendButton( Amarok::icon( "configure" ), 1, 0, QString::null );

}
示例#16
0
void MyFracWindow::createActions()
{
	KAction* actionSave = KStdAction::save(this, SLOT(onFileSave()), actionCollection());
	actionSave->setText(i18n("&Save Image..."));
	KStdAction::quit(kapp, SLOT(quit()), actionCollection());

	KStdAction::copy(this, SLOT(onEditCopy()), actionCollection());
	new KAction(i18n("&Edit Gradient..."), "frgradedit", CTRL+Key_E,
		this, SLOT(onGradientEdit()), actionCollection(), "grad_edit");
	new KAction(i18n("&Invert Gradient"), "frgradinv", CTRL+Key_X,
		this, SLOT(onGradientInvert()), actionCollection(), "grad_inv");

	_actionMandelbrot = KStdAction::up(this, SLOT(setMandelbrotMode()), actionCollection());
	_actionMandelbrot->setText(i18n("&To Mandelbrot"));
	KStdAction::home(this, SLOT(onDefaultView()), actionCollection());
	_actionBack = KStdAction::back(this, SLOT(onViewBack()), actionCollection());
	_actionForward = KStdAction::forward(this, SLOT(onViewForward()), actionCollection());

	createStandardStatusBarAction();
	setStandardToolBarMenuEnabled(true);

	_actionParams = new KToggleAction(i18n("Show Parameters"), SmallIconSet("frparams"), 0,
		_dockParams, SLOT(changeHideShowState()), actionCollection(), "show_params");
	_actionDisplay = new KToggleAction(i18n("Show Display"), SmallIconSet("frdisplay"), 0,
		_dockDisplay, SLOT(changeHideShowState()), actionCollection(), "show_display");
	_actionPreview = new KToggleAction(i18n("Show Preview"), SmallIconSet("viewmag"), 0,
		_dockPreview, SLOT(changeHideShowState()), actionCollection(), "show_preview");
#if KDE_IS_VERSION(3,2,90)
	_actionParams->setCheckedState(i18n("Hide Parameters"));
	_actionDisplay->setCheckedState(i18n("Hide Display"));
	_actionPreview->setCheckedState(i18n("Hide Preview"));
#endif
	KStdAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection());
	KStdAction::configureToolbars(this, SLOT(configureToolbars()), actionCollection());

	connect(dockManager, SIGNAL(change()), this, SLOT(updateShowActions()));
	updateShowActions();
}
示例#17
0
SaverConfig::SaverConfig( TQWidget* parent, const char* name )
    : ConfigWidget( parent, name, true )
{
    connect( m_ok, TQT_SIGNAL(clicked()), TQT_SLOT(apply()) );
    connect( m_ok, TQT_SIGNAL(clicked()), TQT_SLOT(accept()) );
    connect( m_cancel, TQT_SIGNAL(clicked()), TQT_SLOT(reject()) );

    connect( m_multiple, TQT_SIGNAL(toggled(bool)), m_delayLabel, TQT_SLOT(setEnabled(bool)) );
    connect( m_multiple, TQT_SIGNAL(toggled(bool)), m_delay, TQT_SLOT(setEnabled(bool)) );
    connect( m_multiple, TQT_SIGNAL(toggled(bool)), m_secondsLabel, TQT_SLOT(setEnabled(bool)) );
    connect( m_multiple, TQT_SIGNAL(toggled(bool)), m_random, TQT_SLOT(setEnabled(bool)) );

    connect( m_files, TQT_SIGNAL(selectionChanged()), TQT_SLOT(select()) );
    connect( m_add, TQT_SIGNAL(clicked()), TQT_SLOT(add()) );
    connect( m_remove, TQT_SIGNAL(clicked()), TQT_SLOT(remove()) );
    connect( m_up, TQT_SIGNAL(clicked()), TQT_SLOT(up()) );
    connect( m_down, TQT_SIGNAL(clicked()), TQT_SLOT(down()) );

    m_up->setIconSet( SmallIconSet("up") );
    m_down->setIconSet( SmallIconSet("down") );

    // load config
    KConfig *cfg = kapp->config();
    cfg->setGroup( "Misc" );

    bool single = cfg->readBoolEntry( "Single", true );
    m_single->setChecked( single );
    m_multiple->setChecked( !single );
    m_delay->setMinValue( 1 );
    m_delay->setMaxValue( 10000 );
    m_delay->setValue( cfg->readNumEntry( "Delay", 60 ) );
    m_random->setChecked( cfg->readBoolEntry( "Random", false ) );
    m_files->insertStringList( cfg->readListEntry( "Files" ) );

    // update buttons
    select();
}
示例#18
0
void TDEActionSelector::setButtonIcon( const TQString &icon, MoveButton button )
{
  switch ( button )
  {
    case ButtonAdd:
    d->addIcon = icon;
    d->btnAdd->setIconSet( SmallIconSet( icon, d->iconSize ) );
    break;
    case ButtonRemove:
    d->removeIcon = icon;
    d->btnRemove->setIconSet( SmallIconSet( icon, d->iconSize ) );
    break;
    case ButtonUp:
    d->upIcon = icon;
    d->btnUp->setIconSet( SmallIconSet( icon, d->iconSize ) );
    break;
    case ButtonDown:
    d->downIcon = icon;
    d->btnDown->setIconSet( SmallIconSet( icon, d->iconSize ) );
    break;
    default:
    kdDebug(13001)<<"TDEActionSelector::setButtonIcon: DAINBREAD!"<<endl;
  }
}
示例#19
0
KexiDBConnectionWidget::KexiDBConnectionWidget( QWidget* parent,  const char* name )
 : KexiDBConnectionWidgetBase( parent, name )
 , d(new Private())
{
	iconLabel->setPixmap(DesktopIcon("network"));

	QVBoxLayout *driversComboLyr = new QVBoxLayout(frmEngine);
	m_driversCombo = new KexiDBDriverComboBox(frmEngine, Kexi::driverManager().driversInfo(), 
		KexiDBDriverComboBox::ShowServerDrivers);
	lblEngine->setBuddy( m_driversCombo );
	lblEngine->setFocusProxy( m_driversCombo );
	driversComboLyr->addWidget( m_driversCombo );

#ifdef NO_LOAD_DB_LIST
	btnLoadDBList->hide();
#endif
	btnLoadDBList->setIconSet(SmallIconSet("reload"));
	QToolTip::add(btnLoadDBList, i18n("Load database list from the server"));
	QWhatsThis::add(btnLoadDBList, 
		i18n("Loads database list from the server, so you can select one using the \"Name\" combo box."));

	QHBoxLayout *hbox = new QHBoxLayout(frmBottom);
	hbox->addStretch(2);
	d->btnSaveChanges = new KPushButton(KGuiItem(i18n("Save Changes"), "filesave", 
		i18n("Save all changes made to this connection information"),
		i18n("Save all changes made to this connection information. You can later reuse this information.")), 
		frmBottom, "savechanges");
	hbox->addWidget( d->btnSaveChanges );
	hbox->addSpacing( KDialogBase::spacingHint() );
	QWidget::setTabOrder(titleEdit, d->btnSaveChanges);
	d->btnSaveChanges->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );

	d->btnTestConnection = new KPushButton(KGuiItem(i18n("&Test Connection"), "", 
		i18n("Test database connection"), 
		i18n("Tests database connection. You can ensure that valid connection information is provided.")), 
		frmBottom, "testConnection");
	hbox->addWidget( d->btnTestConnection );
	QWidget::setTabOrder(d->btnSaveChanges, d->btnTestConnection);
	d->btnTestConnection->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );

	connect( locationBGrp, SIGNAL(clicked(int)), this, SLOT(slotLocationBGrpClicked(int)) );
	connect( chkPortDefault, SIGNAL(toggled(bool)), this , SLOT(slotCBToggled(bool)) );
	connect( btnLoadDBList, SIGNAL(clicked()), this, SIGNAL(loadDBList()) );
	connect( d->btnSaveChanges, SIGNAL(clicked()), this, SIGNAL(saveChanges()) );
}
示例#20
0
void FindMenu::initialize()
{
  TQStringList list = TDEGlobal::dirs()->findAllResources( "data", "kicker/menuext/find/*.desktop", false, true );

  list.sort();

  int id = 0;

  mConfigList.clear();
  for ( TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) {
    KSimpleConfig config( *it, true );
    config.setDesktopGroup();

    mConfigList.append( *it );
    TQString text = config.readEntry( "Name" );

    insertItem( SmallIconSet( config.readEntry( "Icon" ) ), text, id );
    id++;
  }
}
示例#21
0
/**
 * Received when right-clicking an item in the NickListView.
 */
void NicksOnline::slotNickListView_RightButtonClicked(QListViewItem* item, const QPoint& pt)
{
    if (!item) return;
    m_popupMenu->clear();
    int nickState = getNickAddressbookState(item);
    switch (nickState)
    {
    case nsNotANick:
    {
        break;
    }
    case nsNoAddress:
    {
        m_popupMenu->insertItem(i18n("&Choose Association..."), ciAddressbookChange);
        m_popupMenu->insertItem(i18n("Create New C&ontact..."), ciAddressbookNew);
        m_popupMenu->insertSeparator();
        m_popupMenu->insertItem(i18n("&Whois"), ciWhois);
        m_popupMenu->insertItem(i18n("Open &Query"), ciOpenQuery);
        if (item->text(nlvcServerName).isEmpty())
            m_popupMenu->insertItem(i18n("&Join Channel"), ciJoinChannel);
        break;
    }
    case nsHasAddress:
    {
        m_popupMenu->insertItem(SmallIcon("mail_generic"), i18n("&Send Email..."), ciSendEmail);
        m_popupMenu->insertSeparator();
        m_popupMenu->insertItem(SmallIcon("contents"), i18n("Edit C&ontact..."), ciAddressbookEdit);
        m_popupMenu->insertSeparator();
        m_popupMenu->insertItem(i18n("&Change Association..."), ciAddressbookChange);
        m_popupMenu->insertItem(SmallIconSet("editdelete"), i18n("&Delete Association"), ciAddressbookDelete);
        m_popupMenu->insertSeparator();
        m_popupMenu->insertItem(i18n("&Whois"), ciWhois);
        m_popupMenu->insertItem(i18n("Open &Query"), ciOpenQuery);
        if (item->text(nlvcServerName).isEmpty())
            m_popupMenu->insertItem(i18n("&Join Channel"), ciJoinChannel);
        break;
    }
    }
    if (nickState != nsNotANick)
        m_popupMenu->popup(pt);
}
示例#22
0
void MenuActions::slotPopulateSessions()
{
    int p = 0;
    DM dm;

    m_sessionsMenu->clear();

    if (kapp->authorize("start_new_session") && (p = dm.numReserve()) >= 0)
    {
        if (kapp->authorize("lock_screen"))
            m_sessionsMenu->insertItem( /*SmallIconSet("lockfork"),*/
                                      i18n("Lock Current && Start New Session"),
                                     100);

        m_sessionsMenu->insertItem( SmallIconSet("fork"),
                                  i18n("Start New Session"),
                                  101);

        if (!p)
        {
            m_sessionsMenu->setItemEnabled(100, false);
            m_sessionsMenu->setItemEnabled(101, false);
        }
        m_sessionsMenu->insertSeparator();
    }
    SessList sess;

    if (dm.localSessions(sess))
    {
        for (SessList::ConstIterator it = sess.begin(); it != sess.end(); ++it)
        {
            //int id = m_sessionsMenu->insertItem(DM::sess2Str(*it), (*it).vt);
            DM::sess2Str(*it);
            int id = m_sessionsMenu->insertItem(i18n("%1 - CTRL+ALT+%2").arg((*it).user).arg((*it).vt), (*it).vt);
            if (!(*it).vt)
                m_sessionsMenu->setItemEnabled(id,false);
            if (!(*it).self)
                m_sessionsMenu->setItemChecked(id,false);
        }
    }
}
示例#23
0
TQPopupMenu *KTextBrowser::createPopupMenu( const TQPoint & pos )
{
    enum { IdUndo, IdRedo, IdSep1, IdCut, IdCopy, IdPaste, IdClear, IdSep2, IdSelectAll };

    TQPopupMenu *popup = TQTextBrowser::createPopupMenu( pos );

    if ( isReadOnly() )
      popup->changeItem( popup->idAt(0), SmallIconSet("editcopy"), popup->text( popup->idAt(0) ) );
    else {
      int id = popup->idAt(0);
      popup->changeItem( id - IdUndo, SmallIconSet("undo"), popup->text( id - IdUndo) );
      popup->changeItem( id - IdRedo, SmallIconSet("redo"), popup->text( id - IdRedo) );
      popup->changeItem( id - IdCut, SmallIconSet("editcut"), popup->text( id - IdCut) );
      popup->changeItem( id - IdCopy, SmallIconSet("editcopy"), popup->text( id - IdCopy) );
      popup->changeItem( id - IdPaste, SmallIconSet("editpaste"), popup->text( id - IdPaste) );
      popup->changeItem( id - IdClear, SmallIconSet("editclear"), popup->text( id - IdClear) );
    }

    return popup;
}
示例#24
0
bool Sidebar::eventFilter(QObject *obj, QEvent *ev)
{
  if (ev->type()==QEvent::ContextMenu)
  {
    QContextMenuEvent *e = (QContextMenuEvent *) ev;
    KMultiTabBarTab *bt = dynamic_cast<KMultiTabBarTab*>(obj);
    if (bt)
    {
      kdDebug()<<"Request for popup"<<endl;

      m_popupButton = bt->id();

      ToolView *w = m_idToWidget[m_popupButton];

      if (w)
      {
        KPopupMenu *p = new KPopupMenu (this);

        p->insertTitle(SmallIcon("view_remove"), i18n("Behavior"), 50);

        p->insertItem(w->persistent ? SmallIconSet("window_nofullscreen") : SmallIconSet("window_fullscreen"), w->persistent ? i18n("Make Non-Persistent") : i18n("Make Persistent"), 10);

        p->insertTitle(SmallIcon("move"), i18n("Move To"), 51);

        if (position() != 0)
          p->insertItem(SmallIconSet("back"), i18n("Left Sidebar"),0);

        if (position() != 1)
          p->insertItem(SmallIconSet("forward"), i18n("Right Sidebar"),1);

        if (position() != 2)
          p->insertItem(SmallIconSet("up"), i18n("Top Sidebar"),2);

        if (position() != 3)
          p->insertItem(SmallIconSet("down"), i18n("Bottom Sidebar"),3);

        connect(p, SIGNAL(activated(int)),
              this, SLOT(buttonPopupActivate(int)));

        p->exec(e->globalPos());
        delete p;

        return true;
      }
    }
  }
示例#25
0
CVSService::CVSService(KActionCollection *ac)
{
  m_menu = new KPopupMenu();
  KAction *action = new KAction(i18n("&Commit..."), "vcs_commit", 0, this, SLOT(slotCommit()), ac, "vcs_commit");
  action->plug(m_menu);
  action = new KAction(i18n("&Update"), "vcs_update", 0, this, SLOT(slotUpdate()), ac, "vcs_update");
  action->plug(m_menu);
  KPopupMenu *updateToMenu = new KPopupMenu(m_menu);
  m_menu->insertItem(SmallIconSet("vcs_update"), i18n("Update &To"), updateToMenu);
  action = new KAction(i18n("&Tag/Date..."), "vcs_update", 0, this, SLOT(slotUpdateToTag()), ac, "vcs_update_tag_date");
  action->plug(updateToMenu);
  action = new KAction(i18n("&HEAD"), "vcs_update", 0, this, SLOT(slotUpdateToHead()), ac, "vcs_update_head");
  action->plug(updateToMenu);
  action = new KAction(i18n("Re&vert"), "reload", 0, this, SLOT(slotRevert()), ac, "vcs_revert");
  action->plug(m_menu);
  m_menu->insertSeparator();
  action = new KAction(i18n("&Add to Repository..."), "vcs_add", 0, this, SLOT(slotAdd()), ac, "vcs_add");
  action->plug(m_menu);
  action = new KAction(i18n("&Remove From Repository..."), "vcs_remove", 0, this, SLOT(slotRemove()), ac, "vcs_remove");
  action->plug(m_menu);
  action = new KAction(i18n("&Ignore in CVS Operations"), 0, this, SLOT(slotAddToCVSIgnore()), ac);
  action->plug(m_menu);
  action = new KAction(i18n("Do &Not Ignore in CVS Operations"), 0, this, SLOT(slotRemoveFromCVSIgnore()), ac);
  action->plug(m_menu);
  
  m_menu->insertSeparator();
  action = new KAction(i18n("Show &Log Messages"), 0, this, SLOT(slotBrowseLog()), ac);
  action->plug(m_menu);
    
  m_cvsJob = 0L;
  m_repository = 0L;
  m_cvsService =0L;
  m_commitDlg = new CVSCommitDlgS();
  m_updateToDlg = new CVSUpdateToDlgS();
  m_timer = new QTimer(this);
  connect(m_timer, SIGNAL(timeout()), this, SLOT(slotTimeout()));
}
示例#26
0
void MenuActions::insertDynamicMenu(const QString& menuFile)
{
    MenuInfo info(menuFile);

    if (!info.isValid())
        return;

    KPanelMenu *menu = info.load();
    if (menu)
    {
        if (KickerSettings::menuEntryHeight() > -1)
        {
            insertItem(SmallIconSet(info.icon(),
                       KickerSettings::menuEntryHeight()),
                       info.name(),
                       menu
                      );
        }
        else
        {
            insertItem(info.name(), menu);
        }
        m_subMenus.append(menu);
    }

    if (clients.count() > 0)
    {
        QIntDictIterator<MenuClient> it(clients);
        while (it)
        {
            if (it.current()->text.at(0) != '.')
                insertItem(it.current()->icon, it.current()->text,
                           it.current(), it.currentKey());
            ++it;
        }
    }
}
示例#27
0
KateFileSelector::KateFileSelector( KateMainWindow *mainWindow,
                                    KateViewManager *viewManager,
                                    TQWidget * parent, const char * name )
    : TQVBox (parent, name),
      mainwin(mainWindow),
      viewmanager(viewManager)
{
  mActionCollection = new TDEActionCollection( this );

  TQtMsgHandler oldHandler = tqInstallMsgHandler( silenceQToolBar );

  KateFileSelectorToolBarParent *tbp=new KateFileSelectorToolBarParent(this);
  toolbar = new KateFileSelectorToolBar(tbp);
  tbp->setToolBar(toolbar);
  toolbar->setMovingEnabled(false);
  toolbar->setFlat(true);
  tqInstallMsgHandler( oldHandler );

  cmbPath = new KURLComboBox( KURLComboBox::Directories, true, this, "path combo" );
  cmbPath->setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed ));
  KURLCompletion* cmpl = new KURLCompletion(KURLCompletion::DirCompletion);
  cmbPath->setCompletionObject( cmpl );
  cmbPath->setAutoDeleteCompletionObject( true );
  cmbPath->listBox()->installEventFilter( this );

  dir = new KDirOperator(KURL(), this, "operator");
  dir->setView(KFile::/* Simple */Detail);
  dir->view()->setSelectionMode(KFile::Extended);
  connect ( dir, TQT_SIGNAL( viewChanged(KFileView *) ),
                   this, TQT_SLOT( selectorViewChanged(KFileView *) ) );
  setStretchFactor(dir, 2);

  TDEActionCollection *coll = dir->actionCollection();
  // some shortcuts of diroperator that clashes with Kate
  coll->action( "delete" )->setShortcut( TDEShortcut( ALT + Key_Delete ) );
  coll->action( "reload" )->setShortcut( TDEShortcut( ALT + Key_F5 ) );
  coll->action( "back" )->setShortcut( TDEShortcut( ALT + SHIFT + Key_Left ) );
  coll->action( "forward" )->setShortcut( TDEShortcut( ALT + SHIFT + Key_Right ) );
  // some consistency - reset up for dir too
  coll->action( "up" )->setShortcut( TDEShortcut( ALT + SHIFT + Key_Up ) );
  coll->action( "home" )->setShortcut( TDEShortcut( CTRL + ALT + Key_Home ) );

  // bookmarks action!
  TDEActionMenu *acmBookmarks = new TDEActionMenu( i18n("Bookmarks"), "bookmark",
        mActionCollection, "bookmarks" );
  acmBookmarks->setDelayed( false );
  bookmarkHandler = new KBookmarkHandler( this, acmBookmarks->popupMenu() );
  TQHBox* filterBox = new TQHBox(this);

  btnFilter = new TQToolButton( filterBox );
  btnFilter->setIconSet( SmallIconSet("filter" ) );
  btnFilter->setToggleButton( true );
  filter = new KHistoryCombo( true, filterBox, "filter");
  filter->setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed ));
  filterBox->setStretchFactor(filter, 2);
  connect( btnFilter, TQT_SIGNAL( clicked() ), this, TQT_SLOT( btnFilterClick() ) );

  connect( filter, TQT_SIGNAL( activated(const TQString&) ),
                   TQT_SLOT( slotFilterChange(const TQString&) ) );
  connect( filter, TQT_SIGNAL( returnPressed(const TQString&) ),
           filter, TQT_SLOT( addToHistory(const TQString&) ) );

  // tdeaction for the dir sync method
  acSyncDir = new TDEAction( i18n("Current Document Folder"), "curfiledir", 0,
        TQT_TQOBJECT(this), TQT_SLOT( setActiveDocumentDir() ), mActionCollection, "sync_dir" );
  toolbar->setIconText( TDEToolBar::IconOnly );
  toolbar->setIconSize( 16 );
  toolbar->setEnableContextMenu( false );

  connect( cmbPath, TQT_SIGNAL( urlActivated( const KURL&  )),
             this,  TQT_SLOT( cmbPathActivated( const KURL& ) ));
  connect( cmbPath, TQT_SIGNAL( returnPressed( const TQString&  )),
             this,  TQT_SLOT( cmbPathReturnPressed( const TQString& ) ));
  connect(dir, TQT_SIGNAL(urlEntered(const KURL&)),
             this, TQT_SLOT(dirUrlEntered(const KURL&)) );

  connect(dir, TQT_SIGNAL(finishedLoading()),
             this, TQT_SLOT(dirFinishedLoading()) );

  // enable dir sync button if current doc has a valid URL
  connect ( viewmanager, TQT_SIGNAL( viewChanged() ),
              this, TQT_SLOT( kateViewChanged() ) );

  // Connect the bookmark handler
  connect( bookmarkHandler, TQT_SIGNAL( openURL( const TQString& )),
           this, TQT_SLOT( setDir( const TQString& ) ) );

  waitingUrl = TQString::null;

  // whatsthis help
  TQWhatsThis::add( cmbPath,
       i18n("<p>Here you can enter a path for a folder to display."
            "<p>To go to a folder previously entered, press the arrow on "
            "the right and choose one. <p>The entry has folder "
            "completion. Right-click to choose how completion should behave.") );
  TQWhatsThis::add( filter,
        i18n("<p>Here you can enter a name filter to limit which files are displayed."
             "<p>To clear the filter, toggle off the filter button to the left."
             "<p>To reapply the last filter used, toggle on the filter button." ) );
  TQWhatsThis::add( btnFilter,
        i18n("<p>This button clears the name filter when toggled off, or "
             "reapplies the last filter used when toggled on.") );

}
示例#28
0
KXmlCommandSelector::KXmlCommandSelector(bool canBeNull, QWidget *parent, const char *name, KDialogBase *dlg) : QWidget(parent, name)
{
    m_cmd = new QComboBox(this);
    connect(m_cmd, SIGNAL(activated(int)), SLOT(slotCommandSelected(int)));
    QPushButton *m_add = new KPushButton(this);
    QPushButton *m_edit = new KPushButton(this);
    m_add->setPixmap(SmallIcon("filenew"));
    m_edit->setPixmap(SmallIcon("configure"));
    connect(m_add, SIGNAL(clicked()), SLOT(slotAddCommand()));
    connect(m_edit, SIGNAL(clicked()), SLOT(slotEditCommand()));
    QToolTip::add(m_add, i18n("New command"));
    QToolTip::add(m_edit, i18n("Edit command"));
    m_shortinfo = new QLabel(this);
    m_helpbtn = new KPushButton(this);
    m_helpbtn->setIconSet(SmallIconSet("help"));
    connect(m_helpbtn, SIGNAL(clicked()), SLOT(slotHelpCommand()));
    QToolTip::add(m_helpbtn, i18n("Information"));
    m_helpbtn->setEnabled(false);

    m_line = 0;
    m_usefilter = 0;
    QPushButton *m_browse = 0;

    QVBoxLayout *l0 = new QVBoxLayout(this, 0, 10);

    if(canBeNull)
    {
        m_line = new QLineEdit(this);
        m_browse = new KPushButton(KGuiItem(i18n("&Browse..."), "fileopen"), this);
        m_usefilter = new QCheckBox(i18n("Use co&mmand:"), this);
        connect(m_browse, SIGNAL(clicked()), SLOT(slotBrowse()));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_line, SLOT(setDisabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_browse, SLOT(setDisabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_cmd, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_add, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_edit, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_shortinfo, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), SLOT(slotXmlCommandToggled(bool)));
        m_usefilter->setChecked(true);
        m_usefilter->setChecked(false);
        // setFocusProxy(m_line);
        setTabOrder(m_usefilter, m_cmd);
        setTabOrder(m_cmd, m_add);
        setTabOrder(m_add, m_edit);

        QHBoxLayout *l1 = new QHBoxLayout(0, 0, 10);
        l0->addLayout(l1);
        l1->addWidget(m_line);
        l1->addWidget(m_browse);

        KSeparator *sep = new KSeparator(Qt::Horizontal, this);
        l0->addWidget(sep);
    }
    else
        setFocusProxy(m_cmd);

    QGridLayout *l2 = new QGridLayout(0, 2, (m_usefilter ? 3 : 2), 0, 5);
    int c(0);
    l0->addLayout(l2);
    if(m_usefilter)
    {
        l2->addWidget(m_usefilter, 0, c++);
    }
    l2->addWidget(m_cmd, 0, c);
    QHBoxLayout *l4 = new QHBoxLayout(0, 0, 5);
    l2->addLayout(l4, 1, c);
    l4->addWidget(m_helpbtn, 0);
    l4->addWidget(m_shortinfo, 1);
    QHBoxLayout *l3 = new QHBoxLayout(0, 0, 0);
    l2->addLayout(l3, 0, c + 1);
    l3->addWidget(m_add);
    l3->addWidget(m_edit);

    if(dlg)
        connect(this, SIGNAL(commandValid(bool)), dlg, SLOT(enableButtonOK(bool)));

    loadCommands();
}
示例#29
0
TableEditor::TableEditor(QWidget* parent, const char* name)
  : TableEditorS(parent, name)
{
  m_popup = new KPopupMenu();
  m_cellEditId = m_popup->insertItem(i18n("&Edit Cell Properties"), this ,SLOT(slotEditCell()));
  m_rowEditId = m_popup->insertItem(i18n("Edit &Row Properties"), this ,SLOT(slotEditRow()));
  //  m_colEditId = m_popup->insertItem(i18n("Edit &Column Properties"), this ,SLOT(slotEditCol()));
  m_mergeSeparatorId = m_popup->insertSeparator();
  m_mergeCellsId = m_popup->insertItem(i18n("Merge Cells"), this, SLOT(slotMergeCells()));
  m_unmergeCellsId = m_popup->insertItem(i18n("Break Merging"), this, SLOT(slotUnmergeCells()));

  m_popup->insertSeparator();
  m_popup->insertItem(i18n("&Insert Row"), this, SLOT(slotInsertRow()));
  m_popup->insertItem(i18n("Insert Co&lumn"), this, SLOT(slotInsertCol()));
  m_popup->insertItem(i18n("Remove Row"), this, SLOT(slotRemoveRow()));
  m_popup->insertItem(i18n("Remove Column"), this, SLOT(slotRemoveCol()));
  m_popup->insertSeparator();
  m_popup->insertItem(i18n("Edit &Table Properties"), this, SLOT(slotEditTable()));
  m_editChildId = m_popup->insertItem(i18n("Edit Child Table"), this, SLOT(slotEditChildTable()));

  buttonOk->setIconSet(SmallIconSet("button_ok"));
  buttonCancel->setIconSet(SmallIconSet("button_cancel"));
  buttonHelp->setIconSet(SmallIconSet("help"));

  m_row = m_col = -1;
  m_tbody = 0L;
  m_thead = 0L;
  m_tfoot = 0L;
  m_table = 0L;
  m_dtd = 0L;
  m_write = 0L;
  m_tableDataTags = new QValueList<QValueList<TableNode> >;
  m_tableHeaderTags = new QValueList<QValueList<TableNode> >;
  m_tableFooterTags = new QValueList<QValueList<TableNode> >;
  m_tableTags = 0L;
  m_tableDataRows = new QValueList<TableNode>;
  m_tableHeaderRows = new QValueList<TableNode>;
  m_tableFooterRows = new QValueList<TableNode>;
  m_tableRows = 0L;
  m_createNodes = true;
  newNum += 7;

  connect(headerColSpinBox, SIGNAL(valueChanged(int)), SLOT(slotAddRemoveCol(int)));
  connect(headerRowSpinBox, SIGNAL(valueChanged(int)), SLOT(slotAddRemoveRow(int)));
  connect(rowSpinBox, SIGNAL(valueChanged(int)), SLOT(slotAddRemoveRow(int)));
  connect(colSpinBox, SIGNAL(valueChanged(int)), SLOT(slotAddRemoveCol(int)));
  connect(footerRowSpinBox, SIGNAL(valueChanged(int)), SLOT(slotAddRemoveRow(int)));
  connect(footerColSpinBox, SIGNAL(valueChanged(int)), SLOT(slotAddRemoveCol(int)));
  connect(tableData, SIGNAL(contextMenuRequested(int,int,const QPoint&)),
    SLOT(slotContextMenuRequested(int,int,const QPoint&)));
  connect(pushButton7, SIGNAL(clicked()), SLOT(slotEditTable()));
  connect(pushButton7_2, SIGNAL(clicked()), SLOT(slotEditTableBody()));
  connect(pushButton7_3, SIGNAL(clicked()), SLOT(slotEditTableHeader()));
  connect(pushButton7_4, SIGNAL(clicked()), SLOT(slotEditTableFooter()));
  connect(headerTableData, SIGNAL(contextMenuRequested(int,int,const QPoint&)),
    SLOT(slotContextMenuRequested(int,int,const QPoint&)));
  connect(footerTableData, SIGNAL(contextMenuRequested(int,int,const QPoint&)),
    SLOT(slotContextMenuRequested(int,int,const QPoint&)));
  connect(tabWidget, SIGNAL(currentChanged(QWidget*)), SLOT(slotTabChanged(QWidget*)));
  connect(buttonHelp, SIGNAL(clicked()), SLOT(slotHelpInvoked()));
  connect(tableData, SIGNAL(valueChanged(int,int)), SLOT(slotEditCellText(int,int)));
  connect(headerTableData, SIGNAL(valueChanged(int,int)), SLOT(slotEditCellText(int,int)));
  connect(footerTableData, SIGNAL(valueChanged(int,int)), SLOT(slotEditCellText(int,int)));
}
示例#30
0
/**
 * This function will intialize the playlist window.
 */
void PlaylistWindow::init()
{
    DEBUG_BLOCK

    //this function is necessary because amaroK::actionCollection() returns our actionCollection
    //via the App::m_pPlaylistWindow pointer since App::m_pPlaylistWindow is not defined until
    //the above ctor returns it causes a crash unless we do the initialisation in 2 stages.

    m_browsers = new BrowserBar( this );

    //<Dynamic Mode Status Bar />
    DynamicBar *dynamicBar = new DynamicBar( m_browsers->container());

    { //<Search LineEdit>
        KToolBar *bar = new KToolBar( m_browsers->container(), "NotMainToolBar" );
        bar->setIconSize( 22, false ); //looks more sensible
        bar->setFlat( true ); //removes the ugly frame
        bar->setMovingEnabled( false ); //removes the ugly frame

        QWidget *button = new KToolBarButton( "locationbar_erase", 1, bar );
        QLabel *filter_label = new QLabel( i18n("S&earch:") + " ", bar );
        m_lineEdit = new ClickLineEdit( i18n( "Enter search terms here" ), bar );

        filter_label->setBuddy( m_lineEdit );

        bar->setStretchableWidget( m_lineEdit );
        m_lineEdit->setFrame( QFrame::Sunken );
        m_lineEdit->installEventFilter( this ); //we intercept keyEvents

        connect( button, SIGNAL(clicked()), m_lineEdit, SLOT(clear()) );

        QToolTip::add( button, i18n( "Clear filter" ) );
        QString filtertip = i18n( "Enter space-separated terms to filter the playlist.\n\n"
                                  "Advanced, Google-esque syntax is also available;\n"
                                  "see the handbook (The Playlist section of chapter 4) for details." );

        QToolTip::add( filter_label, filtertip );
        QToolTip::add( m_lineEdit, filtertip );
    } //</Search LineEdit>



    QFrame *playlist = new Playlist( m_browsers->container() );
    dynamicBar->init();
    m_toolbar = new amaroK::ToolBar( m_browsers->container(), "mainToolBar" );
    m_toolbar->setShown( AmarokConfig::showToolbar() );
    QWidget *statusbar = new amaroK::StatusBar( this );

    KAction* repeatAction = amaroK::actionCollection()->action( "repeat" );
    connect( repeatAction, SIGNAL( activated( int ) ), playlist, SLOT( slotRepeatTrackToggled( int ) ) );

    connect( m_lineEdit, SIGNAL(textChanged( const QString& )), playlist, SLOT(setFilterSlot( const QString& )) );

    m_menubar = new KMenuBar( this );
    m_menubar->setShown( AmarokConfig::showMenuBar() );

    //BEGIN Actions menu
    KPopupMenu *actionsMenu = new KPopupMenu( m_menubar );
    actionCollection()->action("playlist_playmedia")->plug( actionsMenu );
    actionCollection()->action("play_audiocd")->plug( actionsMenu );
    actionsMenu->insertSeparator();
    actionCollection()->action("prev")->plug( actionsMenu );
    actionCollection()->action("play_pause")->plug( actionsMenu );
    actionCollection()->action("stop")->plug( actionsMenu );
    actionCollection()->action("next")->plug( actionsMenu );
    actionsMenu->insertSeparator();
    actionCollection()->action(KStdAction::name(KStdAction::Quit))->plug( actionsMenu );

    connect( actionsMenu, SIGNAL( aboutToShow() ), SLOT( actionsMenuAboutToShow() ) );
    //END Actions menu

    //BEGIN Playlist menu
    KPopupMenu *playlistMenu = new KPopupMenu( m_menubar );
    actionCollection()->action("playlist_add")->plug( playlistMenu );
    actionCollection()->action("playlist_save")->plug( playlistMenu );
    playlistMenu->insertSeparator();
    actionCollection()->action("playlist_undo")->plug( playlistMenu );
    actionCollection()->action("playlist_redo")->plug( playlistMenu );
    playlistMenu->insertSeparator();
    actionCollection()->action("playlist_clear")->plug( playlistMenu );
    actionCollection()->action("playlist_shuffle")->plug( playlistMenu );
    actionCollection()->action("playlist_show")->plug( playlistMenu );
    //this one has no real context with regard to the menu
    //actionCollection()->action("playlist_copy")->plug( playlistMenu );
    playlistMenu->insertSeparator();
    actionCollection()->action("queue_selected")->plug( playlistMenu );
    actionCollection()->action("playlist_remove_duplicates")->plug( playlistMenu );
    actionCollection()->action("playlist_select_all")->plug( playlistMenu );
    //END Playlist menu

    //BEGIN Mode menu
    KPopupMenu *modeMenu = new KPopupMenu( m_menubar );
    actionCollection()->action("repeat")->plug( modeMenu );
    KSelectAction *random = static_cast<KSelectAction*>( actionCollection()->action("random_mode") );
    random->plug( modeMenu );
    random->popupMenu()->insertSeparator();
    actionCollection()->action("favor_tracks")->plug( random->popupMenu() );
    //END Mode menu

    //BEGIN Tools menu
    m_toolsMenu = new KPopupMenu( m_menubar );
    m_toolsMenu->insertItem( SmallIconSet( "covermanager" ), i18n("&Cover Manager"), amaroK::Menu::ID_SHOW_COVER_MANAGER );
    actionCollection()->action("queue_manager")->plug( m_toolsMenu );
    m_toolsMenu->insertItem( SmallIconSet( "visualizations"), i18n("&Visualizations"), amaroK::Menu::ID_SHOW_VIS_SELECTOR );
    m_toolsMenu->insertItem( SmallIconSet( "equalizer"), i18n("&Equalizer"), kapp, SLOT( slotConfigEqualizer() ), 0, amaroK::Menu::ID_CONFIGURE_EQUALIZER );
    actionCollection()->action("script_manager")->plug( m_toolsMenu );
    actionCollection()->action("statistics")->plug( m_toolsMenu );
    m_toolsMenu->insertSeparator();
    m_toolsMenu->insertItem( SmallIconSet( "wizard"), i18n("&First-Run Wizard"), amaroK::Menu::ID_SHOW_WIZARD );
    m_toolsMenu->insertItem( SmallIconSet( amaroK::icon( "rescan" ) ), i18n("&Rescan Collection"), amaroK::Menu::ID_RESCAN_COLLECTION );

    #if defined HAVE_XMMS || defined HAVE_LIBVISUAL
    m_toolsMenu->setItemEnabled( amaroK::Menu::ID_SHOW_VIS_SELECTOR, true );
    #else
    m_toolsMenu->setItemEnabled( amaroK::Menu::ID_SHOW_VIS_SELECTOR, false );
    #endif

    connect( m_toolsMenu, SIGNAL( aboutToShow() ), SLOT( toolsMenuAboutToShow() ) );
    connect( m_toolsMenu, SIGNAL( activated(int) ), SLOT( slotMenuActivated(int) ) );
    //END Tools menu

    //BEGIN Settings menu
    m_settingsMenu = new KPopupMenu( m_menubar );
    //TODO use KStdAction or KMainWindow
    static_cast<KToggleAction *>(actionCollection()->action(KStdAction::name(KStdAction::ShowMenubar)))->setChecked( AmarokConfig::showMenuBar() );
    actionCollection()->action(KStdAction::name(KStdAction::ShowMenubar))->plug( m_settingsMenu );
    m_settingsMenu->insertItem( AmarokConfig::showToolbar() ? i18n( "Hide Toolbar" ) : i18n("Show Toolbar"), ID_SHOW_TOOLBAR );
    m_settingsMenu->insertItem( AmarokConfig::showPlayerWindow() ? i18n("Hide Player &Window") : i18n("Show Player &Window"), ID_SHOW_PLAYERWINDOW );
    m_settingsMenu->insertSeparator();
    actionCollection()->action("options_configure_globals")->plug( m_settingsMenu );
    actionCollection()->action(KStdAction::name(KStdAction::KeyBindings))->plug( m_settingsMenu );
    actionCollection()->action(KStdAction::name(KStdAction::ConfigureToolbars))->plug( m_settingsMenu );
    actionCollection()->action(KStdAction::name(KStdAction::Preferences))->plug( m_settingsMenu );

    connect( m_settingsMenu, SIGNAL( activated(int) ), SLOT( slotMenuActivated(int) ) );
    //END Settings menu

    m_menubar->insertItem( i18n( "&Actions" ), actionsMenu );
    m_menubar->insertItem( i18n( "&Playlist" ), playlistMenu );
    m_menubar->insertItem( i18n( "&Mode" ), modeMenu );
    m_menubar->insertItem( i18n( "&Tools" ), m_toolsMenu );
    m_menubar->insertItem( i18n( "&Settings" ), m_settingsMenu );
    m_menubar->insertItem( i18n( "&Help" ), amaroK::Menu::helpMenu() );


    QBoxLayout *layV = new QVBoxLayout( this );
    layV->addWidget( m_menubar );
    layV->addWidget( m_browsers, 1 );
    layV->addWidget( m_toolbar );
    layV->addSpacing( 2 );
    layV->addWidget( statusbar );

    //The volume slider later becomes our FocusProxy, so all wheelEvents get redirected to it
    m_toolbar->setFocusPolicy( QWidget::WheelFocus );
    m_toolbar->setFlat( true );
    m_toolbar->setMovingEnabled( false );
    playlist->setMargin( 2 );
    playlist->installEventFilter( this ); //we intercept keyEvents


    //<XMLGUI>
    {
        QString xmlFile = amaroK::config()->readEntry( "XMLFile", "amarokui.rc" );

        if ( xmlFile == "amarokui_first.rc" )
            // this bug can bite you if you are a pre 1.2 user, we
            // deleted amarokui_first.rc, but we must still support it
            xmlFile = "amarokui.rc";

        setXMLFile( xmlFile );
        createGUI(); //NOTE we implement this
    }
    //</XMLGUI>


    //<Browsers>
    {
        Debug::Block block( "Creating browsers. Please report long start times!" );

        #define addBrowserMacro( Type, name, text, icon ) { \
            Debug::Block block( name ); \
            m_browsers->addBrowser( new Type( name ), text, icon ); }

        #define addInstBrowserMacro( Type, name, text, icon ) { \
            Debug::Block block( name ); \
            m_browsers->addBrowser( Type::instance(), text, icon ); }

        addBrowserMacro( ContextBrowser, "ContextBrowser", i18n( "Context" ), amaroK::icon( "info" ) )
        addBrowserMacro( CollectionBrowser, "CollectionBrowser", i18n( "Collection" ), amaroK::icon( "collection" ) )
        addInstBrowserMacro( PlaylistBrowser, "PlaylistBrowser", i18n( "Playlists" ), amaroK::icon( "playlist" ) )

        //DEBUG: Comment out the addBrowserMacro line and uncomment the m_browsers line (passing in a vfat device name) to see the "virtual root" functionality

        addBrowserMacro( FileBrowser, "FileBrowser", i18n( "Files" ), "folder" )
        //m_browsers->addBrowser( new FileBrowser( "FileBrowser", DeviceManager::instance()->getDevice( "hda5" ) ), i18n( "Files" ), "folder" );

        new MediaBrowser( "MediaBrowser" );
        if( MediaBrowser::isAvailable() )
            addInstBrowserMacro( MediaBrowser, "MediaBrowser", i18n( "Media Device" ), amaroK::icon( "device" ) )
        #undef addBrowserMacro
        #undef addInstBrowserMacro
    }
    //</Browsers>

    connect( Playlist::instance()->qscrollview(), SIGNAL( dynamicModeChanged( const DynamicMode* ) ),
             PlaylistBrowser::instance(), SLOT( loadDynamicItems() ) );


    qApp->installEventFilter( this ); // keyboards shortcuts for the browsers

    connect( playlist, SIGNAL( itemCountChanged(     int, int, int, int, int, int ) ),
             statusbar,  SLOT( slotItemCountChanged( int, int, int, int, int, int ) ) );
    connect( playlist, SIGNAL( queueChanged( const PLItemList &, const PLItemList & ) ),
             statusbar,  SLOT( updateQueueLabel() ) );
    connect( playlist, SIGNAL( aboutToClear() ), m_lineEdit, SLOT( clear() ) );
    amaroK::MessageQueue::instance()->sendMessages();
}