예제 #1
0
파일: MainUI.cpp 프로젝트: abishai/lumina
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI) {
    ui->setupUi(this); //load the designer file
    //setupIcons();
    ui->radio_apps->setChecked(true); //always default to starting here
    ui->tool_stop->setVisible(false); //no search running initially
    ui->tool_configure->setVisible(false); //app search initially set

    livetime = new QTimer(this);
    livetime->setInterval(300); //1/3 second for live searches
    livetime->setSingleShot(true);

    workthread = new QThread(this);
    workthread->setObjectName("Lumina Search Process");

    searcher = new Worker();
    searcher->moveToThread(workthread);

    closeShort = new QShortcut(QKeySequence(tr("Esc")), this);

    //Setup the connections
    connect(livetime, SIGNAL(timeout()), this, SLOT(startSearch()) );
    connect(this, SIGNAL(SearchTerm(QString, bool)), searcher, SLOT(StartSearch(QString, bool)) );
    connect(searcher, SIGNAL(FoundItem(QString)), this, SLOT(foundSearchItem(QString)) );
    connect(searcher, SIGNAL(SearchUpdate(QString)), this, SLOT(searchMessage(QString)) );
    connect(searcher, SIGNAL(SearchDone()), this, SLOT(searchFinished()) );
    connect(ui->tool_stop, SIGNAL(clicked()), this, SLOT(stopSearch()) );
    connect(ui->push_done, SIGNAL(clicked()), this, SLOT(closeApplication()) );
    connect(ui->push_launch, SIGNAL(clicked()), this, SLOT(LaunchItem()) );
    connect(ui->line_search, SIGNAL(textEdited(QString)), this, SLOT(searchChanged()) );
    connect(ui->line_search, SIGNAL(returnPressed()), this, SLOT(LaunchItem()) );
    connect(ui->radio_apps, SIGNAL(toggled(bool)), this, SLOT(searchTypeChanged()) );
    connect(ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(LaunchItem(QListWidgetItem*)) );
    connect(ui->listWidget, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(LaunchItem(QListWidgetItem*)) );
    connect(ui->tool_configure, SIGNAL(clicked()), this, SLOT(configureSearch()) );
    connect(closeShort, SIGNAL(activated()), this, SLOT( close() ) );

    //Setup the settings file
    QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina");
    settings = new QSettings("LuminaDE", "lumina-search",this);
    searcher->startDir = settings->value("StartSearchDir", QDir::homePath()).toString();
    searcher->skipDirs = settings->value("SkipSearchDirs", QStringList()).toStringList();
    updateDefaultStatusTip();
    this->show();
    workthread->start();
    QTimer::singleShot(0,this, SLOT(setupIcons()) );
}
예제 #2
0
ReadMBox::ReadMBox( const UrlInfo* info, MBoxProtocol* parent, bool onlynew, bool savetime )
	: MBoxFile( info, parent ),
	m_file( 0 ),
	m_stream( 0 ),
	m_atend( true ),
	m_prev_time( 0 ),
	m_only_new( onlynew ),
	m_savetime( savetime ),
	m_status( false ),
	m_prev_status( false ),
	m_header( true )
	
{
	if( m_info->type() == UrlInfo::invalid )
		m_mbox->emitError( KIO::ERR_DOES_NOT_EXIST, info->url() );
		
	if( !open( savetime ) )
		m_mbox->emitError( KIO::ERR_CANNOT_OPEN_FOR_READING, info->url() );

	if( m_info->type() == UrlInfo::message )
		if( !searchMessage( m_info->id() ) )
			m_mbox->emitError( KIO::ERR_DOES_NOT_EXIST, info->url() );
}