Пример #1
0
servercontroller::servercontroller( QWidget*, const char* name )
    : KMainWindow( 0, name )
{
  we_are_exiting = false;
  m_notificationCount = 0;

  m_ncm = new nickColourMaker();

  MenuBar = menuBar();
  KWin::setIcons( winId(), kapp->icon(), kapp->miniIcon() );

  s_self = this;

  switch (ksopts->displayMode)
  {
    case KSOptions::SDI:
        displayMgr = new DisplayMgrSDI();
        break;
    case KSOptions::MDI:
        displayMgr = new DisplayMgrMDI();
        break;
  }

  sci = new scInside(this, QCString(name) + "_mainview");
  setCentralWidget(sci);

  sci->setFrameStyle(QFrame::Box | QFrame::Raised);
  ConnectionTree = sci->ConnectionTree;

  connect(ConnectionTree, SIGNAL(clicked( QListViewItem * )),
	  this, SLOT(WindowSelected(QListViewItem *)));

  setFrameBorderWidth(5);

  QPopupMenu *file = new QPopupMenu(this, QCString(name) + "_menu_file");
  KStdAction::quit(this, SLOT(endksirc()), actionCollection())->plug(file);
#ifndef NDEBUG
  file->insertItem(i18n("Dump Object Tree"), this, SLOT(dump_obj()));
  file->insertItem(i18n("Server Debug Window"), this, SLOT(server_debug()));
#endif
  MenuBar->insertItem(i18n("&File"), file);

  connections = new QPopupMenu(this, QCString(name) + "_menu_connections");

  server_id = connections->insertItem(i18n("&New Server..."), this, SLOT(new_connection()), Key_F2 );
  join_id = connections->insertItem(i18n("&Join Channel..."), this, SLOT(new_channel()), Key_F3 );
  connections->insertSeparator();
  connections->insertItem(i18n("&Do Autoconnect..."), this, SLOT(start_autoconnect_check()));
  connections->setItemEnabled(join_id, FALSE);
  MenuBar->insertItem(i18n("&Connections"), connections);

  options = new QPopupMenu(this, QCString(name) + "_menu_options");
  options->setCheckable(TRUE);

  options->insertItem(SmallIcon( "filter" ), i18n("&Filter Rule Editor..."),
		      this, SLOT(filter_rule_editor()));
  options->insertSeparator();
  KStdAction::configureNotifications(this, SLOT(notification_prefs()), actionCollection())->plug(options);

  KStdAction::preferences(this, SLOT(general_prefs()), actionCollection())->plug(options);

  MenuBar->insertItem(i18n("&Settings"), options);

  KHelpMenu *help = new KHelpMenu( this, kapp->aboutData() );
  MenuBar->insertItem( KStdGuiItem::help().text(), help->menu() );

  m_kga = new KGlobalAccel(this, "globalAccess");
  m_kga->insert("New Server", i18n("New Server"),
		i18n("This action allows you to open a new server more easily "
		     "when in docked mode, since you don't need to click on the "
		     "dock icon."),
		ALT+CTRL+Key_C, KKey::QtWIN+CTRL+Key_C, this,
		SLOT(new_connection()));

  open_toplevels = 0;

  pic_server = UserIcon("server");
  pic_gf = UserIcon("ksirc_a");
  pic_run = UserIcon("mini-run");
  pic_ppl = UserIcon("channels");
  pic_icon = UserIcon("ksirc_b");

  setCaption( i18n("Server Control") );
  KWin::setIcons(winId(), pic_icon, pic_server);

  resize( 450,200 );

  dockWidget = new dockServerController(this, 0x0, "servercontroller_dock");
  KWin::setSystemTrayWindowFor( dockWidget->winId(), winId() );

  m_kga->readSettings();
  m_kga->updateConnections();

  checkDocking();
}
Пример #2
0
kdvi::kdvi( char *fname, QWidget *, const char *name )
    : KTopLevelWidget( name )
{
    msg = NULL;
    ssmenu = NULL;
    hbl = NULL;
    prefs = NULL;

    keys = new KAccel(this);

    readConfig();
    setMinimumSize( 400, 60 );
    setCaption( kapp->getCaption() );
    tipgroup = new QToolTipGroup( this, "TipGroup" );
    connect( tipgroup, SIGNAL(showTip(const char *)), SLOT(showTip(const char *)) );
    connect( tipgroup, SIGNAL(removeTip()), SLOT(removeTip()) );

    // Create KPanner for toolBar2 and dviwindow

    kpan = new KPanner( this, "panner",
                        KPanner::O_VERTICAL|KPanner::U_ABSOLUTE, 100);
    setView( kpan, TRUE );
    setFrameBorderWidth( 4 );
    kpan->setAbsSeparator( pannerValue );
    connect( kpan, SIGNAL(positionChanged()), SLOT(pannerChanged()) );

    // Create a dvi window

    dviwin = new dviWindow( basedpi, mfmode, paper, makepk,
                            kpan->child1(), "dviWindow" );
    connect( dviwin, SIGNAL(currentPage(int)), SLOT(setPage(int)) );
    connect( dviwin, SIGNAL(shrinkChanged(int)), SLOT(shrinkChanged(int)) );
    connect( dviwin, SIGNAL(fileChanged()), SLOT(fileChanged()) );
    connect( dviwin, SIGNAL(statusChange(const char *)),
             SLOT(showTip(const char *)) );
    connect( dviwin, SIGNAL(setPoint(QPoint)), SLOT(showPoint(QPoint)) );

    // Create a menubar

    menuBar = NULL;
    makeMenuBar();

    // Create toolbars

    toolBar = NULL;
    makeButtons();
    makeToolBar2( kpan->child0() );

    // Create a statusbar

    statusBar = NULL;
    makeStatusBar( i18n("No document") );

    // Lay out widgets

    QBoxLayout *l;
    l = new QBoxLayout( kpan->child0(), QBoxLayout::LeftToRight );
    l->addWidget( toolBar2 );
    l->activate();
    l = new QBoxLayout( kpan->child1(), QBoxLayout::LeftToRight );
    l->addWidget( dviwin );
    l->activate();

    // Create RMB menu

    rmbmenu = new QPopupMenu;
    rmbmenu->setMouseTracking( TRUE );
    rmbmenu->connectItem( rmbmenu->insertItem(i18n("Toggle Menubar")),
                          this, SLOT(toggleShowMenubar()) );
    rmbmenu->connectItem( rmbmenu->insertItem(i18n("Mark page")),
                          marklist, SLOT(markSelected()) );
    rmbmenu->connectItem( rmbmenu->insertItem(i18n("Redraw")),
                          dviwin, SLOT(drawPage()) );
    rmbmenu->connectItem( rmbmenu->insertItem(i18n("Preferences ...")),
                          this, SLOT(optionsPreferences()) );

    // Bind keys

    bindKeys();
    updateMenuAccel();

// Drag and drop

    KDNDDropZone * dropZone = new KDNDDropZone( this , DndURL);
    connect( dropZone, SIGNAL( dropAction( KDNDDropZone *) ),
             SLOT( dropEvent( KDNDDropZone *) ) );

    // Read config options

    applyPreferences();

    selectSmall();
    dviwin->installEventFilter( this );

    message( "" );
    openFile(QString(fname));
}