Beispiel #1
0
ProfileManageDlg::ProfileManageDlg(const QString &choose, QWidget *parent)
:QDialog(parent)
{
	setupUi(this);
	setModal(true);
	setWindowTitle(CAP(windowTitle()));

	// setup signals
	connect(pb_new, SIGNAL(clicked()), SLOT(slotProfileNew()));
	connect(pb_rename, SIGNAL(clicked()), SLOT(slotProfileRename()));
	connect(pb_delete, SIGNAL(clicked()), SLOT(slotProfileDelete()));
	connect(lbx_profiles, SIGNAL(currentRowChanged(int)), SLOT(updateSelection()));

	// load the listing
	QStringList list = getProfilesList();
	int x = 0;
	for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
		lbx_profiles->addItem(*it);
		if(*it == choose)
			lbx_profiles->setCurrentRow(x);
		++x;
	}

	updateSelection();
}
void Knmap::createMenu( )
{	KStdAction::configureToolbars( this, SLOT( slotConfigureToolbars( )), actionCollection( ));
	KStdAction::keyBindings( this, SLOT( slotConfigureShortcuts( )), actionCollection( ));
	KStdAction::quit( kapp, SLOT( quit( )), actionCollection( ));

	m_fileSaveAction = KStdAction::save( m_mainWidget,
										 SLOT( slotFileSave( )),
										 actionCollection( ));

	m_fileSaveAsAction = KStdAction::saveAs( m_mainWidget,
											 SLOT( slotFileSaveAs( )),
											 actionCollection( ));

	m_settingsManAction = new KAction( i18n( "&Use local man page" ),
										"localman.png",
										0,
										m_mainWidget,
										SLOT( slotSwitchManPages( )),
										actionCollection( ),
										"settings_local" );

	m_useTargetHostAction = new KToggleAction( i18n( "Use target host name" ),
											   NULL,
											   0,
											   m_mainWidget,
											   SLOT( slotUseTargetHost( )),
											   actionCollection( ),
											   "scan_use" );

	m_wrapTextAction = new KToggleAction( i18n( "Wrap text" ),
										  NULL,
										  0,
										  m_mainWidget,
										  SLOT( slotWrapText( )),
										  actionCollection( ),
										  "settings_wrap_text" );

	new KAction( i18n( "Close scan" ),
				 "scanclose",
				 CTRL+Key_W,
				 m_mainWidget,
				 SLOT( slotScanClose( )),
				 actionCollection( ),
				 "scan_close" );

	new KAction( i18n( "Copy profile..." ),
				 "profilecopy",
				 0,
				 m_mainWidget,
				 SLOT( slotProfileCopy( )),
				 actionCollection( ),
				 "profile_copy" );

	new KAction( i18n( "Delete profile..." ),
				 "profiledelete",
				 0,
				 m_mainWidget,
				 SLOT( slotProfileDelete( )),
				 actionCollection( ),
				 "profile_delete" );

	new KAction( i18n( "Display nmap man page" ),
				 "manpage",
				 0,
				 m_mainWidget,
				 SLOT( slotShowManPage( )),
				 actionCollection( ),
				 "help_man_page" );

	new KAction( i18n( "Duplicate scan" ),
				 "scanduplicate",
				 CTRL+Key_C,
				 m_mainWidget,
				 SLOT( slotScanDuplicate( )),
				 actionCollection( ),
				 "scan_duplicate" );

	new KAction( i18n( "Load profile..." ),
				 "profileload",
				 0,
				 m_mainWidget,
				 SLOT( slotProfileLoad( )),
				 actionCollection( ),
				 "profile_load" );

	new KAction( i18n( "man page stylesheet..." ),
				 "manstylesheet",
				 0,
				 m_mainWidget,
				 SLOT( slotSetStylesheet( )),
				 actionCollection( ),
				 "settings_stylesheet" );

	new KAction( i18n( "New scan..." ),
				 "scannew",
				 CTRL+Key_N,
				 m_mainWidget,
				 SLOT( slotScanNew( )),
				 actionCollection( ),
				 "scan_new" );

	new KAction( i18n( "Rename profile..." ),
				 "profilerename",
				 0,
				 m_mainWidget,
				 SLOT( slotProfileRename( )),
				 actionCollection( ),
				 "profile_rename" );

	new KAction( i18n( "Rename scan..." ),
				 "scanrename",
				 Key_F2,
				 m_mainWidget,
				 SLOT( slotScanRename( )),
				 actionCollection( ),
				 "scan_rename" );

	new KAction( i18n( "Save profile..." ),
				 "profilesave",
				 0,
				 m_mainWidget,
				 SLOT( slotProfileSave( )),
				 actionCollection( ),
				 "profile_save" );

	new KAction( i18n( "Save profile as..." ),
				 "profilesaveas",
				 0,
				 m_mainWidget,
				 SLOT( slotProfileSaveAs( )),
				 actionCollection( ),
				 "profile_save_as" );

	new KAction( i18n( "Zoom custom"  ),
				 "zoomcustom",
				 0,
				 m_mainWidget,
				 SLOT( slotZoomCustom( )),
				 actionCollection( ),
				 "settings_zoom_custom"  );

	new KAction( i18n( "Zoom in"  ),
				 "zoomin",
				 0,
				 m_mainWidget,
				 SLOT( slotZoomIn( )),
				 actionCollection( ),
				 "settings_zoom_in"  );

	new KAction( i18n( "Zoom out" ),
				 "zoomout",
				 0,
				 m_mainWidget,
				 SLOT( slotZoomOut( )),
				 actionCollection( ),
				 "settings_zoom_out" );

	m_fileSaveAction->setEnabled( false );
	m_fileSaveAsAction->setEnabled( false );
	m_wrapTextAction->setChecked( m_mainWidget->wrapText( ));

	createStandardStatusBarAction( );
	setStandardToolBarMenuEnabled( true );

#ifdef _DEBUG
	createGUI( QDir::homeDirPath( ) + "/.kde/share/apps/knmap/knmapui.rc" );
#else
	createGUI( );
#endif
}