示例#1
0
KFDMainWindow::KFDMainWindow()
 : KParts::MainWindow()
{
	setXMLFile("kfd_mainwindow.rc");

	setupActions();
	//statusBar()->show();

	KLibFactory *factory = KLibLoader::self()->factory("libkformdesigner_part");
	if (factory)
	{
		QStringList list;
		list << "shell" << "multipleMode";
		m_part = static_cast<KParts::ReadWritePart *>( factory->create(this, "kformdesigner_part", "KParts::ReadWritePart", list) );

		if(m_part)
		{
			setCentralWidget(m_part->widget());
			createGUI(m_part);
		}
	}
	else
	{
		KMessageBox::error(this, i18n("Could not find the KFormDesigner part. Please check your installation."));
		kapp->quit();
		return;
	}

	setAutoSaveSettings();
}
示例#2
0
KBlocksWin::KBlocksWin(KBlocksGameLogic * p, KBlocksPlayManager * pM, int capacity, int gamecount) : KXmlGuiWindow()
{
    //Use up to 3MB for global application pixmap cache
    QPixmapCache::setCacheLimit(3*1024);
    
    mFirstInit = true;
    
    mpKBPlayer = new KBlocksKeyboardPlayer(this);
    mpAIPlayer = new KBlocksAIPlayer();
    
    mMaxGameCapacity = capacity;
    mGameCount = gamecount;
    mpGameLogic = p;
    mpPlayManager = pM;
    
    mpGameScene = new KBlocksScene(mpGameLogic, capacity);
    
    mpGameView = new KBlocksView(mpGameScene, this);
	mpGameView->show();
    setCentralWidget(mpGameView);
    connect(mpGameView, SIGNAL(focusEvent(bool)), this, SLOT(focusEvent(bool)));
    
    setAutoSaveSettings();
    
    setupGUILayout();
}
示例#3
0
KBlocksWin::KBlocksWin(KBlocksGameLogic *p, KBlocksPlayManager *pM, int capacity, int gamecount) : KXmlGuiWindow()
{
    //Use up to 3MB for global application pixmap cache
    QPixmapCache::setCacheLimit(3 * 1024);

    mpKBPlayer = new KBlocksKeyboardPlayer(this);
    mpAIPlayer = new KBlocksAIPlayer();

    mMaxGameCapacity = capacity;
    mGameCount = gamecount;
    mpGameLogic = p;
    connect(mpGameLogic, &KBlocksGameLogic::allGamesStopped,
            this, &KBlocksWin::onAllGamesStopped);

    mpPlayManager = pM;

    mpGameScene = new KBlocksScene(mpGameLogic, capacity);

    connect(mpKBPlayer, &KBlocksKeyboardPlayer::blockMoved,
            mpGameScene, &KBlocksScene::playMoveSound);
    connect(mpKBPlayer, &KBlocksKeyboardPlayer::blockDropped,
            mpGameScene, &KBlocksScene::playDropSound);

    mpGameView = new KBlocksView(mpGameScene, this);
    mpGameView->show();
    setCentralWidget(mpGameView);
    connect(mpGameView, &KBlocksView::focusEvent, this, &KBlocksWin::focusEvent);

    setAutoSaveSettings();

    setupGUILayout();
}
示例#4
0
MainWindow::MainWindow( const QString& marbleDataPath, QWidget *parent )
    : KXmlGuiWindow( parent )
{
    m_part = new MarblePart( this, this, QVariantList() << marbleDataPath );

    setCentralWidget( m_part->widget() );

    insertChildClient( m_part );

    setXMLFile( "marbleui.rc" );

    setStandardToolBarMenuEnabled( true );

    createGUI( 0 );
    QList<QAction*> panelActions = m_part->controlView()->setupDockWidgets( this );
    m_part->unplugActionList( "panels_actionlist" );
    m_part->plugActionList( "panels_actionlist", panelActions );

    // Creating the plugin menus
    m_part->createInfoBoxesMenu();
    m_part->createOnlineServicesMenu();
    m_part->createRenderPluginActions();
	m_part->createFolderList();

    setAutoSaveSettings();

    connect( marbleWidget(), SIGNAL(themeChanged(QString)), 
            this, SLOT(setMapTitle()));
}
Knmap::Knmap( )
: KMainWindow( NULL, "knmap" ),
  m_mainWidget( new MainWidget( this, "main widget" ))
{	findNmap( );
	setCentralWidget( m_mainWidget );
	readSettings(  );
	createMenu( );
	setAutoSaveSettings( );

	connect( m_mainWidget,
			 SIGNAL( outputAvailable( const bool, const bool )),
			 SLOT( slotOutputAvailable( const bool, const bool)));

	connect( m_mainWidget,
			 SIGNAL( setManPageActionStuff( const bool )),
			 SLOT( slotSetManPageActionStuff( const bool )));

	connect( m_mainWidget,
			 SIGNAL( setCaption( const QString& )),
			 SLOT( slotSetCaption( const QString& )));

	connect( m_mainWidget,
			 SIGNAL( statusBarText( const QString& )), statusBar( ),
			 SLOT( message( const QString& )));

	connect( m_mainWidget,
			 SIGNAL( visibleScanWidgetChanged( ScanWidget* )),
			 SLOT( slotVisibleScanWidgetChanged( ScanWidget* )));
}
示例#6
0
Portal::Portal( QWidget *parent, KCmdLineArgs *args, const char* name)
: KXmlGuiWindow( parent, 0 ),
  mCmdLineArgs( args )
{
  setObjectName( name );
  ///////////////////////////////////////////////////////////////////
  // call inits to invoke all other construction parts
  initStatusBar();
  initActions();
  initView();

  setAttribute( Qt::WA_QuitOnClose );
  ///////////////////////////////////////////////////////////////////
  // disable actions at startup
  editCut->setEnabled(false);
  editCopy->setEnabled(false);
  editPaste->setEnabled(false);

  mAddressProvider = new AddressProvider( this );
  connect( mAddressProvider, SIGNAL( addresseeFound( const QString&, const KABC::Addressee&)),
          this, SLOT( slotReceivedMyAddress( const QString&, const KABC::Addressee& ) ) );

  setAutoSaveSettings();
  QTimer::singleShot( 0, this, SLOT( slotStartupChecks() ) );
}
示例#7
0
MainWindow::MainWindow( const QString& marbleDataPath, QWidget *parent )
    : KXmlGuiWindow( parent )
{
    m_part = new MarblePart( this, this, QVariantList() << marbleDataPath );

    setCentralWidget( m_part->widget() );

    insertChildClient( m_part );

    setXMLFile( "marbleui.rc" );

    setStandardToolBarMenuEnabled( true );

    createGUI( 0 );

    // Creating the plugin menus
    m_part->createInfoBoxesMenu();
    m_part->createOnlineServicesMenu();
	m_part->createFolderList();

    setAutoSaveSettings();

    connect( marbleWidget(), SIGNAL( themeChanged( QString ) ), 
	     this, SLOT( setMapTitle() ) );
}
KTNEFMain::KTNEFMain( QWidget *parent )
  : KXmlGuiWindow( parent )
{
  setupActions();
  setupStatusbar();

  setupTNEF();

  KConfigGroup config( KGlobal::config(), "Settings" );
  mDefaultDir = config.readPathEntry( "defaultdir", "/tmp/" );
  mLastDir = mDefaultDir;

  // create personale temo extract dir
  KStandardDirs::makeDir( KGlobal::dirs()->localkdedir() + "/share/apps/ktnef/tmp" );

  resize( 430, 350 );

  setStandardToolBarMenuEnabled( true );

  createStandardStatusBarAction();

  setupGUI( Keys | Save | Create, "ktnefui.rc" );

  setAutoSaveSettings();
}
示例#9
0
MyFracWindow::MyFracWindow() : KDockMainWindow(NULL, "mainwnd", WType_TopLevel),
	_posValid(false),
	_juliaMode(false),
	_maxIter(0.5),
	_threshold(0.5),
	_gradientData(NULL),
	_scrollTimer(NULL),
	_scrollDir(0),
	_generator(this, false),
	_progressDialog(NULL)
{
	KImageIO::registerFormats();

	generatorThread.start(QThread::LowPriority);

	createWidgets();
	createActions();
	createGUI();

	_presets.loadPresets(kapp->config());
	readParameters();

	onDefaultView();
	updateMode();

	_scrollTimer = new QTimer(this);
	connect(_scrollTimer, SIGNAL(timeout()), SLOT(scrollTimer()));

	resize(700, 520);

	setAutoSaveSettings();
	readDockConfig();
}
示例#10
0
KISDNnet::KISDNnet()
    : KMainWindow( 0, "KISDNnet" ),
      m_view(new KISDNnetView(this))
{
    // accept dnd
    setAcceptDrops(true);

    // tell the KMainWindow that this is indeed the main widget
    setCentralWidget(m_view);

    // then, setup our actions
    setupActions();

    // and a status bar
    statusBar()->show();

    // apply the saved mainwindow settings, if any, and ask the mainwindow
    // to automatically save settings if changed: window size, toolbar
    // position, icon size, etc.
    setAutoSaveSettings();

    // allow the view to change the statusbar and caption
    connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)),
            this,   SLOT(changeStatusbar(const QString&)));
    connect(m_view, SIGNAL(signalChangeCaption(const QString&)),
            this,   SLOT(changeCaption(const QString&)));
	readProfiles();

}
示例#11
0
kerp::kerp()
    : KMainWindow( 0, "kerp" ),
      m_view(new kerpView(this)),
      m_printer(0)
{
    // accept dnd
    setAcceptDrops(true);

    // tell the KMainWindow that this is indeed the main widget
    setCentralWidget(m_view);

    // then, setup our actions
    setupActions();

    // and a status bar
    statusBar()->show();

    // apply the saved mainwindow settings, if any, and ask the mainwindow
    // to automatically save settings if changed: window size, toolbar
    // position, icon size, etc.
    setAutoSaveSettings();

    // allow the view to change the statusbar and caption
    connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)),
            this,   SLOT(changeStatusbar(const QString&)));
    connect(m_view, SIGNAL(signalChangeCaption(const QString&)),
            this,   SLOT(changeCaption(const QString&)));
    createConnection();
	kdDebug()<<"going to create il"<<endl;
	kdDebug()<<"testing global to string 7"<<Global::toString(7)<<endl;
	InvoiceLine *il=new InvoiceLine(1);
	kdDebug()<<"out the if "<<endl;
	kdDebug()<<"il created :"<< il->getProduct();
}
示例#12
0
CViewer::CViewer()
{
    KPluginFactory *factory=KPluginLoader("kfontviewpart").factory();

    if(factory)
    {
        itsPreview=factory->create<KParts::ReadOnlyPart>(this);

        actionCollection()->addAction(KStandardAction::Open, this, SLOT(fileOpen()));
        actionCollection()->addAction(KStandardAction::Quit, this, SLOT(close()));
        actionCollection()->addAction(KStandardAction::KeyBindings, this, SLOT(configureKeys()));
        itsPrintAct=actionCollection()->addAction(KStandardAction::Print, itsPreview, SLOT(print()));

        itsPrintAct->setEnabled(false);

        if(itsPreview->browserExtension())
            connect(itsPreview->browserExtension(), SIGNAL(enableAction(const char*,bool)),
                    this, SLOT(enableAction(const char*,bool)));

        setCentralWidget(itsPreview->widget());
        createGUI(itsPreview);

        setAutoSaveSettings();
        applyMainWindowSettings(KSharedConfig::openConfig()->group("MainWindow"));
    }
    else
示例#13
0
MainWindow::MainWindow(const QUrl& url)
    : m_markpad(0)
    , m_recentFiles(0)
    , m_firstTextChange(false)
{
    m_markpad = new Markpado(this);
    
    setupAction();
    setupConnect();
    
    
    setCentralWidget(m_markpad);
    setupGUI(QSize(500,600), Default, "markpado.rc");
    guiFactory()->addClient(m_markpad->m_editor);
    setStandardToolBarMenuEnabled(true);
    
    // FIXME: make sure the config dir exists, any idea how to do it more cleanly?
    QDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation)).mkpath(QStringLiteral("."));    
    
    setAutoSaveSettings();
    readConfig();
    
    slotOpen(url);
    show();
}
示例#14
0
void KEBApp::construct() {
    CurrentMgr::self()->createManager(m_bookmarksFilename);

    ListView::self()->updateListViewSetup(m_readOnly);
    ListView::self()->updateListView();
    ListView::self()->widget()->setFocus();

    slotClipboardDataChanged();
    setAutoSaveSettings();
}
Krecipes::Krecipes(): KXmlGuiWindow( 0 )
{
    m_view = new KrecipesView( this );
    setObjectName( "Krecipes" );
    // accept dnd
    setAcceptDrops( true );

    // tell the KMainWindow that this is indeed the main widget
    setCentralWidget( m_view );

    // then, setup our actions
    setupActions();

    // and a status bar
    statusBar() ->show();
    statusLabel = new QLabel;
    statusBar()->addPermanentWidget( statusLabel );

    // apply the saved mainwindow settings, if any, and ask the mainwindow
    // to automatically save settings if changed: window size, toolbar
    // position, icon size, etc.
    setAutoSaveSettings();


    // allow the view to change the statusbar and caption
    connect( m_view, SIGNAL( signalChangeStatusbar( const QString& ) ),
             this, SLOT( changeStatusbar( const QString& ) ) );
    connect( m_view, SIGNAL( signalChangeCaption( const QString& ) ),
             this, SLOT( changeCaption( const QString& ) ) );

    connect( m_view, SIGNAL( panelShown( KrePanel, bool ) ), SLOT( updateActions( KrePanel, bool ) ) );

    connect( m_view, SIGNAL( recipeSelected(bool) ), SLOT( recipeSelected(bool) ) );


    // Enable/Disable the Save Button (Initialize disabled, and connect signal)

    connect( m_view, SIGNAL( enableSaveOption( bool ) ), this, SLOT( enableSaveOption( bool ) ) );

    enableSaveOption( false ); // Disables saving initially
    recipeSelected( false ); //nothing is selected initially

    parsing_file_dlg = new KDialog( this );
    parsing_file_dlg->setObjectName( "parsing_file_dlg" );
    parsing_file_dlg->setModal( true );
    //parsing_file_dlg->setWindowFlags ( Qt::WX11BypassWM );
    QLabel *parsing_file_dlg_label = new QLabel( i18n( "Gathering recipe data from file.\nPlease wait..." ), parsing_file_dlg );
    parsing_file_dlg_label->setFrameStyle( QFrame::Box | QFrame::Raised );
    //( new QVBoxLayout( parsing_file_dlg ) ) ->addWidget( parsing_file_dlg_label );
    parsing_file_dlg->setMainWidget( parsing_file_dlg_label );
    parsing_file_dlg->adjustSize();
    //parsing_file_dlg->setFixedSize(parsing_file_dlg->size());
    convertDialog = new ConversionDialog(this,m_view->database);
}
示例#16
0
文件: kwrite.cpp 项目: cmacq2/kate
KWrite::KWrite(KTextEditor::Document *doc)
    : m_view(0)
    , m_recentFiles(0)
    , m_paShowPath(0)
    , m_paShowMenuBar(0)
    , m_paShowStatusBar(0)
    , m_activityResource(0)
{
    if (!doc) {
        doc = KTextEditor::Editor::instance()->createDocument(0);

        // enable the modified on disk warning dialogs if any
        if (qobject_cast<KTextEditor::ModificationInterface *>(doc)) {
            qobject_cast<KTextEditor::ModificationInterface *>(doc)->setModifiedOnDiskWarning(true);
        }

        docList.append(doc);
    }

    m_view = doc->createView(this);

    setCentralWidget(m_view);

    setupActions();

    // signals for the statusbar
    connect(m_view->document(), &KTextEditor::Document::modifiedChanged, this, &KWrite::modifiedChanged);
    connect(m_view->document(), SIGNAL(documentNameChanged(KTextEditor::Document*)), this, SLOT(documentNameChanged()));
    connect(m_view->document(), SIGNAL(readWriteChanged(KTextEditor::Document*)), this, SLOT(documentNameChanged()));
    connect(m_view->document(), SIGNAL(documentUrlChanged(KTextEditor::Document*)), this, SLOT(urlChanged()));

    setAcceptDrops(true);
    connect(m_view, SIGNAL(dropEventPass(QDropEvent*)), this, SLOT(slotDropEvent(QDropEvent*)));

    setXMLFile(QStringLiteral("kwriteui.rc"));
    createShellGUI(true);
    guiFactory()->addClient(m_view);

    // FIXME: make sure the config dir exists, any idea how to do it more cleanly?
    QDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation)).mkpath(QStringLiteral("."));

    // call it as last thing, must be sure everything is already set up ;)
    setAutoSaveSettings();

    readConfig();

    winList.append(this);

    documentNameChanged();
    show();

    // give view focus
    m_view->setFocus(Qt::OtherFocusReason);
}
示例#17
0
void KMarkNote::setupUI()
{
    KConfigGroup cg(KGlobal::config(), "KMarkNote");
    setAutoSaveSettings(cg, true);

    setCentralWidget(m_view);
    setupGUI(QSize(500,600), Default, "kmarknote.rc");
    guiFactory()->addClient(m_view->getEditor());
    setStandardToolBarMenuEnabled(true);
    restoreWindowSize(cg);
}
KHDAPSMonitorMain::KHDAPSMonitorMain() : KMainWindow()
{
  widget = new KHDAPSMonitorWidget(this);
  setCentralWidget(widget);

  trayIcon = new KHDAPSMonitorSysTray(this, "KHDAPSMonitorSysTray");
  trayIcon->show();

  timer = new QTimer(this);
  connect(timer, SIGNAL(timeout()), this, SLOT(update()));
  timer->start(UPDATE_INTERVAL);

  setAutoSaveSettings();
}
示例#19
0
KgpgApp::KgpgApp(TQWidget *parent, const char *name, WFlags f,TDEShortcut goHome,bool mainWindow):TDEMainWindow(parent, name,f)
{
	isMainWindow=mainWindow;
	textEncoding=TQString();
        readOptions();
	goDefaultKey=goHome;
        // call inits to invoke all other construction parts

        initActions();
        initView();

	slotSetFont(KGpgSettings::font());
        setupGUI(( ToolBar | Keys | StatusBar | Save | Create ), "kgpg.rc");
	setAutoSaveSettings("Editor",true);

}
MainWindow::MainWindow()
  : KXmlGuiWindow( 0 )
{
  mMainWidget = new MainWidget( this, this );

  setCentralWidget( mMainWidget );

  initActions();

  setStandardToolBarMenuEnabled( true );

  toolBar()->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );

  setupGUI( Keys | Save | Create, "kaddressbookui.rc" );

  setAutoSaveSettings();
}
示例#21
0
ContainmentShell::ContainmentShell()
    : KParts::MainWindow( ),
      m_dialog(0)
{
    setXMLFile("plasma-kpart-shellui.rc");

    KAction *action = KStandardAction::quit(qApp, SLOT(quit()), actionCollection());
    action = new KAction("&Configure", actionCollection());
    connect(action, SIGNAL(triggered()), this, SLOT(optionsPreferences()));
    actionCollection()->addAction("options_configure", action);

    // this routine will find and load our Part.  it finds the Part by
    // name which is a bad idea usually.. but it's alright in this
    // case since our Part is made for this Shell
    KService::Ptr service = KService::serviceByDesktopPath( "plasma-kpart.desktop" );

    if (service) {
        Plasma::PluginLoader *loader = new TestShellPluginLoader();
        m_part = service->createInstance<KParts::ReadOnlyPart>(0, QVariantList() << qVariantFromValue(loader));

        if (m_part) {
            // tell the KParts::MainWindow that this is indeed the main widget
            setCentralWidget(m_part->widget());

            // and integrate the part's GUI with the shell's
            createGUI(m_part);
        } else {
            // For whatever reason the part didn't load
            KMessageBox::error(this, "Could not instantiate our Part!");
            qApp->quit();
        }
    } else {
        // if we couldn't find our Part, we exit since the Shell by
        // itself can't do anything useful
        KMessageBox::error(this, "Could not find our Part!");
        qApp->quit();
        // we return here, cause qApp->quit() only means "exit the
        // next time we enter the event loop...
        return;
    }

    // apply the saved mainwindow settings, if any, and ask the mainwindow
    // to automatically save settings if changed: window size, toolbar
    // position, icon size, etc.
    setAutoSaveSettings();
}
示例#22
0
MainWindow::MainWindow(QWidget *parent)
    : KXmlGuiWindow(parent), m_clickCount(0),
      m_view(new GameView(this))
{
    connect(m_view, &GameView::gameOver, this, &MainWindow::gameOver);
    connect(m_view, &GameView::rotationStarted, this, &MainWindow::rotationStarted);
    connect(this, SIGNAL(pause(QVariant)), m_view->rootObject(), SLOT(pause(QVariant)));

    m_movesLabel = new QLabel(this);
    m_movesLabel->setAlignment(Qt::AlignCenter);
    m_timeLabel = new QLabel(this);
    m_timeLabel->setAlignment(Qt::AlignCenter);

    statusBar()->insertPermanentWidget(0, m_movesLabel, 1);
    statusBar()->insertPermanentWidget(1, m_timeLabel, 1);

    // Difficulty
    Kg::difficulty()->addStandardLevelRange(
        KgDifficultyLevel::Easy, KgDifficultyLevel::VeryHard
    );
    Kg::difficulty()->addLevel(
                new KgDifficultyLevel(100, QByteArray("Custom"), i18n("Custom"))
    );
    KgDifficultyGUI::init(this);
    connect(Kg::difficulty(), &KgDifficulty::currentLevelChanged, this, &MainWindow::startNewGame);


    setCentralWidget(m_view);

    setupActions();

    setupGUI();

    setAutoSaveSettings();

    qsrand(time(0));

    m_gameClock = new KGameClock(this, KGameClock::MinSecOnly);
    connect(m_gameClock, &KGameClock::timeChanged, this, &MainWindow::updateStatusBar);

    m_soundStart = new KgSound(QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("sounds/start.wav")), this);
    m_soundWin = new KgSound(QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("sounds/win.wav")), this);


    startNewGame();
}
示例#23
0
MainWindow::MainWindow(RootSection* document, const KComponentData &componentData) : m_doc(document), m_activeView(0), m_dockerManager(0)
{
    Q_ASSERT(componentData.isValid());
    KGlobal::setActiveComponent(componentData);

    // then, setup our actions
    setupActions();

    // Create the docker manager after setting up the action
    m_dockerManager = new DockerManager(this);

    // Setup the view
    view = new View(m_doc, this);
    setCentralWidget(view);

    // a call to KXmlGuiWindow::setupGUI() populates the GUI
    // with actions, using KXMLGUI.
    // It also applies the saved mainwindow settings, if any, and ask the
    // mainwindow to automatically save settings if changed: window size,
    // toolbar position, icon size, etc.
    setupGUI();

    activateView(view);

    // Position and show toolbars according to user's preference
    setAutoSaveSettings(componentData.componentName());

    const int scnum = QApplication::desktop()->screenNumber(parentWidget());
    QRect desk = QApplication::desktop()->screenGeometry(scnum);

    // if the desktop is virtual then use virtual screen size
    if(QApplication::desktop()->isVirtualDesktop())
        desk = QApplication::desktop()->screenGeometry(QApplication::desktop()->screen());

    KConfigGroup config(KGlobal::config(), componentData.componentName());
    const QSize size(config.readEntry(QString::fromLatin1("Width %1").arg(desk.width()), 0),
                     config.readEntry(QString::fromLatin1("Height %1").arg(desk.height()), 0));
    resize(size);

    foreach(QDockWidget * wdg, m_dockWidgets) {
        if((wdg->features() & QDockWidget::DockWidgetClosable) == 0) {
            wdg->setVisible(true);
        }
    }
    forceDockTabFonts();
}
示例#24
0
void KatalogView::init(const QString& katName )
{
  m_katalogName = katName;
  initActions();

  ///////////////////////////////////////////////////////////////////
  // set up a vertical layout box
  QWidget *w = new QWidget(this);
  QBoxLayout *box = new QVBoxLayout(w);

  // start to set up the listview
  createCentralWidget(box, w);
  KatalogListView *listview = getListView();

  if( ! listview ) {
      // qDebug () << "ERROR: No listview created !!!" << endl;
  } else {
      m_filterHead = new FilterHeader(w, listview);
      box->insertWidget(0, m_filterHead);

      connect( listview, SIGNAL(currentItemChanged ( QTreeWidgetItem*, QTreeWidgetItem*)),
               this, SLOT(slTreeviewItemChanged( QTreeWidgetItem*, QTreeWidgetItem*)) );
      connect( listview, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
               this, SLOT(slEditTemplate()));
      connect( listview, SIGNAL(templateHoovered(CatalogTemplate*)),
               this, SLOT(slotShowTemplateDetails( CatalogTemplate*)));

      // Populate the context Menu
      (listview->contextMenu())->addAction( m_acEditItem );
      (listview->contextMenu())->addAction( m_acNewItem );
      (listview->contextMenu())->addAction( m_acDeleteItem );
      (listview->contextMenu())->addSeparator();
      (listview->contextMenu())->addAction( m_acAddChapter );
      (listview->contextMenu())->addAction( m_acEditChapter );
      (listview->contextMenu())->addAction( m_acRemChapter );
      getKatalog( katName );
      listview->addCatalogDisplay( katName );
  }

  setCentralWidget(w);
  m_editListViewItem = 0;
  // qDebug () << "Getting katalog!" << katName << endl;

  setAutoSaveSettings( QString::fromLatin1( "CatalogWindow" ),  true );
}
示例#25
0
KPlistEditor::KPlistEditor()
    : KParts::MainWindow( )
{
    // set the shell's ui resource file
    //setXMLFile("kplisteditor_shell.rc");

    // then, setup our actions
    setupActions();

    // this routine will find and load our Part.  it finds the Part by
    // name which is a bad idea usually.. but it's alright in this
    // case since our Part is made for this Shell
    KLibFactory *factory = KLibLoader::self()->factory("libkplisteditorpart");
    if (factory)
    {
        // now that the Part is loaded, we cast it to a Part to get
        // our hands on it
        m_part = static_cast<KParts::ReadWritePart *>(factory->create(this,
                                "KPlistEditorPart" ));

        if (m_part)
        {
            // tell the KParts::MainWindow that this is indeed the main widget
            setCentralWidget(m_part->widget());

            // and integrate the part's GUI with the shell's
            setupGUI();
        }
    }
    else
    {
        // if we couldn't find our Part, we exit since the Shell by
        // itself can't do anything useful
        KMessageBox::error(this, i18n("Could not find our Part!"));
        qApp->quit();
        // we return here, cause qApp->quit() only means "exit the
        // next time we enter the event loop...
        return;
    }

    // apply the saved mainwindow settings, if any, and ask the mainwindow
    // to automatically save settings if changed: window size, toolbar
    // position, icon size, etc.
    setAutoSaveSettings();
}
示例#26
0
文件: sweeper.cpp 项目: KDE/sweeper
Sweeper::Sweeper(bool automatic)
   : KXmlGuiWindow(0)
   , m_privacyConfGroup(KSharedConfig::openConfig(QLatin1String( "kprivacyrc" ), KConfig::NoGlobals), "Cleaning")
   , m_automatic(automatic)
{
   QWidget *mainWidget = new QWidget(this);
   ui.setupUi(mainWidget);
   setCentralWidget(mainWidget);

   QTreeWidget *sw = ui.privacyListView;

   KStandardAction::quit(this, SLOT(close()), actionCollection());

   createGUI(QLatin1String( "sweeperui.rc" ));

   setAutoSaveSettings();

   generalCLI     = new QTreeWidgetItem(QStringList() << i18nc("General system content", "General"));
   sw->addTopLevelItem(generalCLI);
   webbrowsingCLI = new QTreeWidgetItem(QStringList() << i18nc("Web browsing content", "Web Browsing"));
   sw->addTopLevelItem(webbrowsingCLI);

   generalCLI->setExpanded(true);
   webbrowsingCLI->setExpanded(true);

   this->InitActions();


   connect(ui.cleanupButton, SIGNAL(clicked()), SLOT(cleanup()));
   connect(ui.selectAllButton, SIGNAL(clicked()), SLOT(selectAll()));
   connect(ui.selectNoneButton, SIGNAL(clicked()), SLOT(selectNone()));

   new KsweeperAdaptor(this);
   QDBusConnection::sessionBus().registerObject(QLatin1String( "/ksweeper" ), this);

   load();

   if(automatic) {
      cleanup();
      close();
   }
}
KAddressBookMain::KAddressBookMain( const QString &file )
    : KXmlGuiWindow( 0 )
{
    // Set this to be the group leader for all subdialogs - this means
    // modal subdialogs will only affect this dialog, not the other windows
    setAttribute( Qt::WA_GroupLeader );

    setCaption( i18n( "Address Book Browser" ) );

    mCore = new KABCore( this, true, this, file );
    mCore->restoreSettings();

    initActions();

    setCentralWidget( mCore->widget() );

    statusBar()->show();
    statusBar()->insertItem( "", 1 );

    KPIM::ProgressDialog *progressDialog = new KPIM::ProgressDialog( statusBar(),
            this );
    progressDialog->hide();

    KPIM::StatusbarProgressWidget *progressWidget;
    progressWidget = new KPIM::StatusbarProgressWidget( progressDialog,
            statusBar() );
    progressWidget->show();

    statusBar()->addPermanentWidget( progressWidget, 0 );

    mCore->setStatusBar( statusBar() );

    setStandardToolBarMenuEnabled( true );

    createGUI( "kaddressbookui.rc" );

    resize( 400, 300 ); // initial size
    setAutoSaveSettings();

    new CoreAdaptor( this );
    QDBusConnection::sessionBus().registerObject("/KAddressBook", this, QDBusConnection::ExportAdaptors);
}
示例#28
0
MainWindow::MainWindow()
    : m_markpad(0)
    , m_recentFiles(0)
    , m_firstTextChange(false)
{
    m_markpad = new Markpado(this);

    setupAction();
    setupConnect();

    setCentralWidget(m_markpad);
    setupGUI(QSize(500,600), Default, "markpado.rc");
    guiFactory()->addClient(m_markpad->m_editor);
    setStandardToolBarMenuEnabled(true);
    
    setAutoSaveSettings();
    readConfig();

    show();
}
示例#29
0
CervisiaShell::CervisiaShell( const char *name )
  : m_part(0)
{
    setObjectName( name );
    setXMLFile( "cervisiashellui.rc" );

    KPluginLoader loader("cervisiapart5");
    if( KPluginFactory *factory = loader.factory() )
    {
        m_part = factory->create< KParts::ReadOnlyPart >(this);
        if( m_part )
        {
            m_part->setObjectName( "cervisiaview" );
            setCentralWidget(m_part->widget());
        }
    }
    else
    {
        KMessageBox::detailedError(this, i18n("The Cervisia library could not be loaded."),
                                   loader.errorString() +
                                   QLatin1String("\n") + loader.pluginName() +
                                   QLatin1String("\n") + loader.fileName());
        qApp->quit();
        return;
    }

    setupActions();

    //
    // Magic needed for status texts
    //
    createGUI( m_part );

    // enable auto-save of toolbar/menubar/statusbar and window size settings
    // and apply the previously saved settings
    setAutoSaveSettings("MainWindow", true);

    // if the session is restoring, we already read the settings
    if( !qApp->isSessionRestored() )
        readSettings();
}
KLinPopup::KLinPopup()
	: KMainWindow( 0, "KLinPopup" ),
	  m_view(new KLinPopupView(this)), watcher(0),
	  unreadMessages(0), hasInotify(true)
{
	setFocusPolicy(QWidget::StrongFocus);

	// tell the KMainWindow that this is indeed the main widget
	setCentralWidget(m_view);

	// then, setup our actions
	setupActions();

	// apply the saved mainwindow settings, if any, and ask the mainwindow
	// to automatically save settings if changed: window size, toolbar
	// position, icon size, etc.
	setAutoSaveSettings();

	cfg = KGlobal::config();
	readConfig();

	initSystemTray();

	// allow the view to change the statusbar and caption
	connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)),
			this,   SLOT(changeStatusbar(const QString&)));
	connect(m_view, SIGNAL(signalChangeCaption(const QString&)),
			this,   SLOT(changeCaption(const QString&)));


	updateStats();
	checkSmbclientBin();

	messageList.setAutoDelete(true);

	// use a timer to finish the constructor ASAP
	QTimer *watchTimer = new QTimer(this);
	connect(watchTimer, SIGNAL(timeout()), this, SLOT(startWatch()));
	watchTimer->start(1, true);
}