Beispiel #1
0
void *AboutPlugin::processEvent(Event *e)
{
    if (e->type() == EventCommandExec){
        CommandDef *cmd = (CommandDef*)(e->param());
        if (cmd->id == CmdBugReport){
            Event eURL(EventGoURL, (void*)"http://sourceforge.net/tracker/?group_id=56866");
            eURL.process();
        }
        if (cmd->id == CmdAbout){
            if (about == NULL)
            {
                KAboutData *about_data = getAboutData();
                about_data->setTranslator(
                    I18N_NOOP("_: NAME OF TRANSLATORS\nYour names"),
                    I18N_NOOP("_: EMAIL OF TRANSLATORS\nYour emails"));

                about = new KAboutApplication( about_data, NULL, "about", false );
                connect(about, SIGNAL(finished()), this, SLOT(aboutDestroyed()));
            }
            raiseWindow(about);
        }
#ifdef USE_KDE
        if (cmd->id == CmdAboutKDE){
            if (about_kde == NULL)
            {
                about_kde = new KAboutKDE( NULL, "aboutkde", false);
                connect(about_kde, SIGNAL(finished()), this, SLOT(aboutDestroyed()));
            }
            raiseWindow(about_kde);
        }
#endif
    }
    return NULL;
}
Beispiel #2
0
void MainWindow::start()
{
	QString sockpath = QString( "zuluMount-gui.socket" ) ;
	oneinstance * instance = new oneinstance( this,sockpath,"raiseWindow",m_device ) ;
	if( !instance->instanceExist() ){
		connect( instance,SIGNAL( raise() ),this,SLOT( raiseWindow() ) ) ;
		connect( instance,SIGNAL( raiseWithDevice( QString ) ),this,SLOT( raiseWindow( QString ) ) ) ;
		this->setUpApp() ;
	}
}
Beispiel #3
0
bool UpdatePlugin::done(unsigned, Buffer&, const char *headers)
{
        string h = getHeader("Location", headers);
        if (h.empty()){
            time_t now;
            time(&now);
            setTime(now);
            Event e(EventSaveState);
            e.process();
        }else{
            QWidget *main = getMainWindow();
            if (main == NULL)
                return NULL;
            Command cmd;
            cmd->id		= CmdStatusBar;
            Event eWidget(EventCommandWidget, cmd);
            QWidget *statusWidget = (QWidget*)(eWidget.process());
            if (statusWidget == NULL)
                return NULL;
            m_url = h;
            QStringList l;
            l.append(i18n("Show details"));
            l.append(i18n("Remind later"));
            raiseWindow(main);
            m_msg = new BalloonMsg(NULL, i18n("New version SIM is released"), l, statusWidget);
            connect(m_msg, SIGNAL(action(int, void*)), this, SLOT(showDetails(int, void*)));
            connect(m_msg, SIGNAL(finished()), this, SLOT(msgDestroyed()));
            m_msg->show();
        }
		return false;
}
Beispiel #4
0
void changeWindowPosition(Window* dest_window, unsigned short new_x, unsigned short new_y) {

	Rect overlap_rect;

	//If a window is moved, we must ensure that it is the active window 
	markWindowVisible(dest_window, 1);
	raiseWindow(dest_window);

	//Create a rectangle covering the old location for later intersection
	overlap_rect.top = dest_window->y;
	overlap_rect.left = dest_window->x;
	overlap_rect.bottom = overlap_rect.top + dest_window->h - 1;
	overlap_rect.right = overlap_rect.left + dest_window->w - 1;

	dest_window->x = new_x;
	dest_window->y = new_y;

	//Need to update the screen if we're visible    
	if (dest_window->flags & WIN_VISIBLE) {

		//Should update this so that we don't redraw stuff that's going to
		//be under the window's new location because we're going to draw
		//over that when we draw the window at the new location anyhow     
		updateOverlapped(&overlap_rect, dest_window); //Redraw all of the siblings that this window was covering up

		//Redraw the window at its new location
		dest_window->frame_needs_redraw = 1;
		drawWindow(dest_window, 0);
	}

	return;
}
Beispiel #5
0
void XfitMan::maximizeWindow(Window _wid, MaximizeDirection direction) const
{
    Atom atom1 = 0, atom2= 0;
    switch (direction)
    {
        case MaximizeHoriz:
            atom1 = atom("_NET_WM_STATE_MAXIMIZED_HORZ");
            break;

        case MaximizeVert:
            atom1 = atom("_NET_WM_STATE_MAXIMIZED_VERT");
            break;

        case MaximizeBoth:
            atom1 = atom("_NET_WM_STATE_MAXIMIZED_VERT");
            atom2 = atom("_NET_WM_STATE_MAXIMIZED_HORZ");
            break;

    }

    clientMessage(_wid, atom("_NET_WM_STATE"),
                  _NET_WM_STATE_ADD,
                  atom1, atom2,
                  SOURCE_PAGER);
    raiseWindow(_wid);
}
Beispiel #6
0
int main(int argc, char** argv) {
    int ret = 2;
    if (argc < 2 || argc > 3) {
        usage(argv);
        return 2;
    }
    Display *display = XOpenDisplay(NULL);
    if (!display) {
        fputs("Unable to open display\n", stderr);
        return 1;
    }
    switch (argv[1][0]) {
        case 'l':
            if (argc > 3) {
                usage(argv);
                break;
            }
            ret = listMapped(display, argc >= 3 ? argv[2] : "");
            break;
        case 'r':
            if (argc != 3) {
                usage(argv);
                break;
            }
            ret = raiseWindow(display, (Window)strtol(argv[2], NULL, 0));
            break;
        default:
            usage(argv);
            break;
    }
    XCloseDisplay(display);
    return ret;
}
Beispiel #7
0
void FileTransferDlgNotify::createFile(const QString &name, unsigned size)
{
	m_name = name;
	m_size = size;
	m_name = m_name.replace(QRegExp("\\\\"), "/");
	int n = m_name.findRev("/");
	if (n > 0)
		m_name = m_name.mid(n + 1);
	m_dlg->m_msg->addFile(m_name, size);
	FileTransfer *ft = m_dlg->m_msg->m_transfer;
	QString shortName = m_name;
	m_name = ft->dir() + m_name;
	if (ft->m_file)
		delete ft->m_file;
	m_dlg->process();
	ft->m_file = new QFile(m_name);
	if (ft->m_file->exists()){
		switch (ft->overwrite()){
		case Skip:
			skip();
			return;
		case Replace:
			if (ft->m_file->open(IO_WriteOnly | IO_Truncate)){
				ft->startReceive(0);
				return;
			}
			break;
		case Resume:
			if (ft->m_file->open(IO_WriteOnly)){
				resume();
				return;
			}
			break;
		default:
			if (ft->m_file->open(IO_WriteOnly)){
				QStringList buttons;
				buttons.append(i18n("&Replace"));
				buttons.append(i18n("&Skip"));
				if (ft->m_file->size() < size)
					buttons.append(i18n("Resu&me"));
				BalloonMsg *ask = new BalloonMsg(NULL, 
					i18n("File %1 exists") .arg(shortName), buttons, m_dlg->lblState);
				QObject::connect(ask, SIGNAL(action(int, void*)), m_dlg, SLOT(action(int, void*)));
				raiseWindow(m_dlg);
				ask->show();
				return;
			}
		}
	}else{
		if (ft->m_file->open(IO_WriteOnly)){
			ft->startReceive(0);
			return;
		}
	}
	QString errMsg = i18n("Can't create: %1") .arg(m_name);
	m_dlg->m_msg->setError(errMsg.utf8());
	ft->setError();
}
Beispiel #8
0
void SpellConfig::find()
{
#ifdef WIN32
    if (m_find == NULL){
        m_find = new SpellFind(edtPath);
        connect(m_find, SIGNAL(finished()), this, SLOT(findFinished()));
    }
    raiseWindow(m_find);
#endif
}
Beispiel #9
0
void GpgCfg::find()
{
#ifdef WIN32
    if (m_find == NULL){
        m_find = new GpgFind(edtGPG);
        connect(m_find, SIGNAL(finished()), this, SLOT(findFinished()));
    }
    raiseWindow(m_find);
#endif
}
Beispiel #10
0
void NetmonitorPlugin::showMonitor()
{
    if (monitor == NULL)
    {
        monitor = new MonitorWindow(this);
        restoreGeometry(monitor, data.geometry);
        connect(monitor, SIGNAL(finished()), this, SLOT(finished()));
    }
    raiseWindow(monitor);
}
Beispiel #11
0
void MenuWindowManager::focusWindow(Window* win)
{
	PersistentWindowCache* persistCache = PersistentWindowCache::instance();
	if (!persistCache->shouldPersistWindow(win)) {
		return;
	}

	showMenuWindow(win);

	raiseWindow(win);
}
Beispiel #12
0
void MainWindow::Show()
{
	QStringList l = QCoreApplication::arguments() ;

	m_startHidden  = l.contains( "-e" ) ;
	m_folderOpener = utility::cmdArgumentValue( l,"-m","xdg-open" ) ;
	m_env          = utility::cmdArgumentValue( l,"-z","" ) ;

	utility::setUID( utility::cmdArgumentValue( l,"-K","-1" ).toInt() ) ;

	QString volume = utility::cmdArgumentValue( l,"-d" ) ;

	new oneinstance( this,"zuluMount-gui.socket","startGUI",volume,[ this,volume ]( QObject * instance ){

		connect( instance,SIGNAL( raise() ),this,SLOT( raiseWindow() ) ) ;
		connect( instance,SIGNAL( raiseWithDevice( QString ) ),this,SLOT( raiseWindow( QString ) ) ) ;

		this->setUpApp( volume ) ;
	} ) ;
}
Beispiel #13
0
void NetmonitorPlugin::showMonitor()
{
    if (monitor == NULL)
    {
        monitor = new MonitorWindow(this);
        bool bPos = (data.geometry[LEFT].value != NO_DATA) && (data.geometry[TOP].value != NO_DATA);
        bool bSize = (data.geometry[WIDTH].value != NO_DATA) && (data.geometry[HEIGHT].value != NO_DATA);
        restoreGeometry(monitor, data.geometry, bPos, bSize);
        connect(monitor, SIGNAL(finished()), this, SLOT(finished()));
    }
    raiseWindow(monitor);
}
Beispiel #14
0
Pager::Pager(KWMModuleApplication *a, char *name) : QWidget(NULL,  "kwmpager")
{
    kwmmapp = a;
    a->setMainWidget(this);
    kwmmapp -> connectToKWM();
    KWM::setSticky(winId(), true);
    KWM::setDecoration(winId(), KWM::tinyDecoration | KWM::noFocus);
    KWM::setWmCommand(winId(), name);
    KWM::setUnsavedDataHint(winId(), false);

    int count = KWM::numberOfDesktops();
    desktop_font = new QFont();
    Desktop *desk;

    desktops.resize(count);
    for (int i = 0; i < count; i++) {
        desk = new Desktop(a, i + 1, this);
        desktops[i] = desk;
    }
    
    activeDesktop = desktops.at(KWM::currentDesktop() - 1);
    activeDesktop->activate(true);
    
    connect(kwmmapp, SIGNAL(desktopChange(int)) , 
	    SLOT(changeDesktop(int)));
    connect(kwmmapp, SIGNAL(init()), 
	    SLOT(initDesktops()));
    connect(kwmmapp, SIGNAL( desktopNumberChange(int)), 
	    SLOT(changeNumber(int)));
    connect(kwmmapp, SIGNAL( windowAdd(Window)), 
	    SLOT(addWindow(Window)));
    connect(kwmmapp, SIGNAL( windowRemove(Window)), 
	    SLOT(removeWindow(Window)));
    connect(kwmmapp, SIGNAL( windowChange(Window)), 
	    SLOT(windowChange(Window)));
    connect(kwmmapp, SIGNAL( windowRaise(Window)), 
	    SLOT(raiseWindow(Window)));
    connect(kwmmapp, SIGNAL( windowLower(Window)), 
	    SLOT(lowerWindow(Window)));
    connect(kwmmapp, SIGNAL( windowActivate(Window)), 
	    SLOT(windowActivate(Window)));
    connect(kwmmapp, SIGNAL( commandReceived(QString)),
	    SLOT(receiveCommand(QString)));

    moved = false;
    readSettings();
    initDesktops();
    show();
    placeIt();
}
Beispiel #15
0
void MainWindow::Show()
{
	QStringList l = QCoreApplication::arguments() ;

	m_startHidden  = l.contains( "-e" ) ;
	m_folderOpener = utility::cmdArgumentValue( l,"-m","xdg-open" ) ;

	if( utility::userIsRoot() ){

		utility::setUID( utility::cmdArgumentValue( l,"-K","-1" ).toInt() ) ;
	}

	QString volume = utility::cmdArgumentValue( l,"-d" ) ;

	auto instance = new oneinstance( this,"zuluMount-gui.socket","startGUI",volume ) ;

	if( instance->onlyInstance() ){

		connect( instance,SIGNAL( raise() ),this,SLOT( raiseWindow() ) ) ;
		connect( instance,SIGNAL( raiseWithDevice( QString ) ),this,SLOT( raiseWindow( QString ) ) ) ;

		this->setUpApp( volume ) ;
	}
}
Beispiel #16
0
/*+++++++++++++++++++++++++++++++++++++++*/
void 
popup_keyboardBB(
        Widget shell )
{
    if (style.kbdDialog == NULL) 
    {
      _DtTurnOnHourGlass(shell);  
      build_keyboardDlg(shell);
      XtManageChild(style.kbdDialog);
      _DtTurnOffHourGlass(shell);  
    }
    else 
    {
      XtManageChild(style.kbdDialog);
      raiseWindow(XtWindow(XtParent(style.kbdDialog)));
    }
}
void WindowSystem::handleRequest()
{
    // read request(s)
    QTcpSocket *connection = qobject_cast<QTcpSocket*>(sender());
    QDataStream stream(connection);
    while (!stream.atEnd()) {
        qDebug() << "SERVER: reading request";
        Request request;
        stream >> request;
        // ### FIXME: verify that message type is request
        switch (request.type) {
        case Request::CreateWindowRequest: {
            quint32 id = createWindow(request.id);
            m_connections.insert(id, connection);
            Response response(Response::CreatedWindowResponse, id);
            qDebug() << "SERVER: sending response";
            stream << response;
            break; }
        case Request::DestroyWindowRequest:
            destroyWindow(request.id);
            break;
        case Request::ShowWindowRequest:
            showWindow(request.id);
            break;
        case Request::HideWindowRequest:
            hideWindow(request.id);
            break;
        case Request::RaiseWindowRequest:
            raiseWindow(request.id);
            break;
        case Request::LowerWindowRequest:
            lowerWindow(request.id);
            break;
        case Request::UpdateWindowRequest:
            updateWindow(request.id, request.rect);
            break;
        case Request::SetWindowGeometryRequest:
            setWindowGeometry(request.id, request.rect);
            break;
        default:
            qWarning() << "SERVER: unknown request type" << request.type;
            break;
        };
    } // while (!stream.atEnd())
}
void *LoginDialog::processEvent(Event *e)
{
    switch (e->type()){
    case EventClientChanged:
        if (m_bLogin && ((m_client == NULL) || ((Client*)(e->param()) == m_client))){
            if (((Client*)(e->param()))->getState() == Client::Connected){
                QTimer::singleShot(0, this, SLOT(loginComplete()));
                return NULL;
            }
        }
        break;
    case EventClientError:
        if (m_bLogin){
            clientErrorData *d = (clientErrorData*)(e->param());
            if (m_client){
                if (d->client != m_client)
                    return NULL;
            }else{
                for (unsigned i = 0; i < passwords.size(); i++){
                    Client *client = getContacts()->getClient(i);
                    if (client->getState() != Client::Error)
                        return e->param();
                }
            }
            stopLogin();
            QString msg;
            if (d->err_str && *d->err_str){
                msg = i18n(d->err_str);
                if (d->args){
                    msg = msg.arg(QString::fromUtf8(d->args));
                    free(d->args);
                }
            }else{
                msg = i18n("Login failed");
            }
            if (msg.length()){
                raiseWindow(this);
                BalloonMsg::message(msg, buttonOk);
            }
            return e->param();
        }
        break;
    }
    return NULL;
}
Beispiel #19
0
void *MainWindow::processEvent(Event *e)
{
    CommandDef *cmd;
    WindowDef  *wnd;
    switch(e->type()){
    case EventSetMainIcon:
        m_icon = (const char*)(e->param());
        setIcon(Pict(m_icon.c_str()));
        break;
    case EventInit:{
            setTitle();
            BarShow b;
            b.bar_id = ToolBarMain;
            b.parent = this;
            Event e(EventShowBar, &b);
            bar = (QToolBar*)e.process();
            restoreToolbar(bar, CorePlugin::m_plugin->data.toolBarState);
            raiseWindow(this);
            break;
        }
    case EventCommandExec:
        cmd = (CommandDef*)(e->param());
        if (cmd->id == CmdQuit)
            quit();
        break;
    case EventAddWindow:
        wnd = (WindowDef*)(e->param());
        addWidget(wnd->widget, wnd->bDown);
        return e->param();
    case EventAddStatus:
        wnd = (WindowDef*)(e->param());
        addStatus(wnd->widget, wnd->bDown);
        return e->param();
    case EventIconChanged:
        setIcon(Pict(m_icon.c_str()));
        break;
    case EventContactChanged:{
            Contact *contact = (Contact*)(e->param());
            if (contact == getContacts()->owner())
                setTitle();
            break;
        }
    }
    return NULL;
}
Beispiel #20
0
int SimApp::newInstance()
{
    if (firstInstance){
        firstInstance = false;
    }else{
        QWidgetList  *list = QApplication::topLevelWidgets();
        QWidgetListIt it( *list );
        QWidget *w;
        while ( (w=it.current()) != 0 ) {
            ++it;
            if (w->inherits("MainWindow")){
                raiseWindow(w);
            }
        }
        delete list;
    }
    return 0;
}
Beispiel #21
0
static WWindow *change_focus_and_raise(WWindow *newFocused, WWindow *oldFocused,
				       WSwitchPanel *swpanel, WScreen *scr, Bool esc_cancel)
{
	if (!newFocused)
		return oldFocused;

	wWindowFocus(newFocused, oldFocused);
	oldFocused = newFocused;

	if (wPreferences.circ_raise) {
		CommitStacking(scr);

		if (!esc_cancel)
			raiseWindow(swpanel, newFocused);
	}

	return oldFocused;
}
Beispiel #22
0
void Commands::customize(CommandsDef *def)
{
    QWidgetList  *list = QApplication::topLevelWidgets();
    QWidgetListIt it( *list );
    QWidget * w;
    ToolBarSetup *wnd = NULL;
    while ( (w=it.current()) != 0 ){
        ++it;
        if (!w->inherits("ToolBarSetup")) continue;
        ToolBarSetup *swnd = static_cast<ToolBarSetup*>(w);
        if (swnd->m_def != def) continue;
        wnd = swnd;
        break;
    }
    if (wnd == NULL) wnd= new ToolBarSetup(this, def);
    raiseWindow(wnd);
    delete list;
}
Beispiel #23
0
void 
popup_dtwmBB(
        Widget shell )
{
    if (style.dtwmDialog == NULL) {
      _DtTurnOnHourGlass(shell);  
      build_dtwmDlg(shell);
      getDtwmValues();
      XtManageChild(style.dtwmDialog);
      _DtTurnOffHourGlass(shell);  
    }
    else 
    {
        XtManageChild(style.dtwmDialog);
        raiseWindow(XtWindow(XtParent(style.dtwmDialog)));
    }
    dtwm.systemDefaultFlag = False;
}
void RKConsole::pipeCommandThroughConsoleLocal (RCommand *command) {
	RK_TRACE (APP);

	emit (raiseWindow ());
	if (isBusy () || (!currentCommand ().isEmpty ())) {
		int res = KMessageBox::questionYesNo (this, i18n ("You have configured RKWrad to run script commands through the console. However, the console is currently busy (either a command is running, or you have started to enter text in the console). Do you want to bypass the console this one time, or do you want to try again later?"), i18n ("Console is busy"), KGuiItem (i18n ("Bypass console")), KGuiItem (i18n ("Cancel")));
		if (res == KMessageBox::Yes) {
			RKGlobals::rInterface ()->issueCommand (command);
		}
	} else {
		QString text = command->command ();
		text.replace ("\n", QString ("\n") + iprefix);
		doc->insertText (doc->numLines () - 1, QString (nprefix).length (), text + '\n');
		command->addReceiver (this);
		command->addTypeFlag (RCommand::Console);
		current_command = command;
		RKGlobals::rInterface ()->issueCommand (command);
	}
}
Beispiel #25
0
void MenuWindowManager::showMenuWindow(Window* win)
{
	if (!m_winArray.contains(win))
		m_winArray.append(win);

	PersistentWindowCache* persistCache = PersistentWindowCache::instance();
	if (persistCache->shouldPersistWindow(win)) {

		if (!persistCache->hasWindow(win))
			persistCache->addWindow(win);

		persistCache->showWindow(win);
	}

	raiseWindow(win);
	
	setPosTopLeft(win, m_positiveSpace.x(), m_positiveSpace.y());
	SystemUiController::instance()->setMenuVisible(true);

	update(m_positiveSpace);
}
Beispiel #26
0
void 
popup_i18nBB(
        Widget shell )
{
    int ret = NoError;

    if (style.i18nDialog == NULL) {
      _DtTurnOnHourGlass(shell);  
      BuildI18nDlg(shell);
      ret = InitI18nValues(shell);
      XtManageChild(style.i18nDialog);
      if (ret != NoError)
	  _DtI18nErrorDialog(ret) ;
      _DtTurnOffHourGlass(shell);  
    }
    else 
    {
        XtManageChild(style.i18nDialog);
        raiseWindow(XtWindow(XtParent(style.i18nDialog)));
    }
}
Beispiel #27
0
void *UpdatePlugin::processEvent(Event *e)
{
    if (e->type() == EventFetchDone){
        fetchData *data = (fetchData*)(e->param());
        if (data->req_id != m_fetch_id)
            return NULL;
        string h = getHeader("Location", data->headers);
        if (h.empty()){
            time_t now;
            time(&now);
            setTime(now);
            Event e(EventSaveState);
            e.process();
        }else{
            QWidget *main = getMainWindow();
            if (main == NULL)
                return NULL;
            Command cmd;
            cmd->id		= CmdStatusBar;
            Event eWidget(EventCommandWidget, cmd);
            QWidget *statusWidget = (QWidget*)(eWidget.process());
            if (statusWidget == NULL)
                return NULL;
            m_url = h;
            QStringList l;
            l.append(i18n("Show details"));
            l.append(i18n("Remind later"));
            raiseWindow(main);
            BalloonMsg *msg = new BalloonMsg(NULL, i18n("New version SIM is released"), l, statusWidget);
            connect(msg, SIGNAL(action(int, void*)), this, SLOT(showDetails(int, void*)));
            connect(msg, SIGNAL(destroyed()), this, SLOT(msgDestroyed()));
            msg->show();
            return NULL;
        }
        m_fetch_id = 0;
    }
Beispiel #28
0
void MainWindow::setUpApp( const QString& volume )
{
	this->setLocalizationLanguage() ;
	m_ui = new Ui::MainWindow ;
	m_ui->setupUi( this ) ;

	this->setFixedSize( this->size() ) ;

	m_ui->tableWidget->setColumnWidth( 0,220 ) ;
	m_ui->tableWidget->setColumnWidth( 1,320 ) ;
	m_ui->tableWidget->setColumnWidth( 2,145 ) ;
	m_ui->tableWidget->setColumnWidth( 4,87 ) ;
	m_ui->tableWidget->setColumnWidth( 5,87 ) ;
	m_ui->tableWidget->hideColumn( 3 ) ;

#if QT_VERSION < QT_VERSION_CHECK( 5,0,0 )
	m_ui->tableWidget->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents ) ;
#else
	m_ui->tableWidget->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents ) ;
#endif
	m_ui->tableWidget->verticalHeader()->setMinimumSectionSize( 30 ) ;

	this->setAcceptDrops( true ) ;
	this->setWindowIcon( QIcon( ":/zuluMount.png" ) ) ;

	m_ui->tableWidget->setMouseTracking( true ) ;

	connect( m_ui->tableWidget,SIGNAL( itemEntered( QTableWidgetItem * ) ),this,SLOT( itemEntered( QTableWidgetItem * ) ) ) ;
	connect( m_ui->tableWidget,SIGNAL( currentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ),
		 this,SLOT( slotCurrentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ) ) ;
	connect( m_ui->pbmount,SIGNAL( clicked() ),this,SLOT( pbMount() ) ) ;
	connect( m_ui->pbupdate,SIGNAL( clicked()),this,SLOT( pbUpdate() ) ) ;
	connect( m_ui->pbclose,SIGNAL( clicked() ),this,SLOT( pbClose() ) ) ;
	connect( m_ui->tableWidget,SIGNAL( itemClicked( QTableWidgetItem * ) ),this,SLOT( itemClicked( QTableWidgetItem * ) ) ) ;
	connect( m_ui->pbunlockencfs,SIGNAL( clicked() ),this,SLOT( unlockencfs() ) ) ;

	connect( this,SIGNAL( unlistVolume( QString ) ),this,SLOT( removeVolume( QString ) ) ) ;

	this->setUpShortCuts() ;

	this->setUpFont() ;

	m_trayIcon = new QSystemTrayIcon( this ) ;
	m_trayIcon->setIcon( QIcon( ":/zuluMount.png" ) ) ;

	auto trayMenu = new QMenu( this ) ;

	m_autoMountAction = new QAction( this ) ;
	m_autoMount = this->autoMount() ;
	m_autoMountAction->setCheckable( true ) ;
	m_autoMountAction->setChecked( m_autoMount ) ;

	m_autoMountAction->setText( tr( "Automount Volumes" ) ) ;

	connect( m_autoMountAction,SIGNAL( toggled( bool ) ),this,SLOT( autoMountToggled( bool ) ) ) ;

	trayMenu->addAction( m_autoMountAction ) ;

	auto autoOpenFolderOnMount = new QAction( this ) ;
	autoOpenFolderOnMount->setCheckable( true ) ;
	m_autoOpenFolderOnMount = this->autoOpenFolderOnMount() ;
	autoOpenFolderOnMount->setChecked( m_autoOpenFolderOnMount ) ;
	autoOpenFolderOnMount->setText( tr( "Auto Open Mount Point" ) ) ;
	connect( autoOpenFolderOnMount,SIGNAL( toggled( bool ) ),this,SLOT( autoOpenFolderOnMount( bool ) ) ) ;

	trayMenu->addAction( autoOpenFolderOnMount ) ;

	auto ac = new QAction( this ) ;
	ac->setText( tr( "Show The Interface" ) ) ;
	connect( ac,SIGNAL( triggered() ),this,SLOT( raiseWindow() ) ) ;

	trayMenu->addAction( ac ) ;

	ac = new QAction( this ) ;
	ac->setText( tr( "Unmount All" ) ) ;
	connect( ac,SIGNAL( triggered() ),this,SLOT( unMountAll() ) ) ;

	trayMenu->addAction( ac ) ;

	m_favorite_menu = trayMenu->addMenu( tr( "Favorites" ) ) ;
	connect( m_favorite_menu,SIGNAL( triggered( QAction * ) ),this,SLOT( favoriteClicked( QAction * ) ) ) ;
	connect( m_favorite_menu,SIGNAL( aboutToShow() ),this,SLOT( showFavorites() ) ) ;

	m_not_hidden_volume_menu = trayMenu->addMenu( tr( "Hide Volume From View" ) ) ;
	connect( m_not_hidden_volume_menu,SIGNAL( triggered( QAction * ) ),this,SLOT( removeVolumeFromVisibleVolumeList( QAction * ) ) ) ;
	connect( m_not_hidden_volume_menu,SIGNAL( aboutToShow() ),this,SLOT( showVisibleVolumeList() ) ) ;

	m_hidden_volume_menu = trayMenu->addMenu( tr( "Unhide Volume From View" ) ) ;
	connect( m_hidden_volume_menu,SIGNAL( triggered( QAction * ) ),this,SLOT( removeVolumeFromHiddenVolumeList( QAction * ) ) ) ;
	connect( m_hidden_volume_menu,SIGNAL( aboutToShow() ),this,SLOT( showHiddenVolumeList() ) ) ;

	ac = new QAction( this ) ;
	ac->setText( tr( "About" ) ) ;
	connect( ac,SIGNAL( triggered() ),this,SLOT( licenseInfo() ) ) ;
	trayMenu->addAction( ac ) ;

	trayMenu->addAction( tr( "Quit" ),this,SLOT( pbClose() ) ) ;
	m_trayIcon->setContextMenu( trayMenu ) ;

	connect( m_trayIcon,SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ),
		 this,SLOT( slotTrayClicked( QSystemTrayIcon::ActivationReason ) ) ) ;

	m_trayIcon->show() ;

	QString dirPath = utility::homePath() + "/.zuluCrypt/" ;
	QDir dir( dirPath ) ;

	if( !dir.exists() ){
		dir.mkdir( dirPath ) ;
	}

	this->disableAll() ;

	this->startAutoMonitor() ;

	this->updateVolumeList( zuluMountTask::updateVolumeList().await() ) ;

	if( volume.isEmpty() ) {
		this->enableAll() ;
	}else{
		this->showMoungDialog( volume ) ;
	}
}
Beispiel #29
0
void *StatusFrame::processEvent(Event *e)
{
    CommandDef *cmd;
    switch (e->type()){
    case EventCheckState:
        cmd = (CommandDef*)(e->param());
        if ((cmd->menu_id == MenuStatusWnd) && (cmd->id == CmdStatusWnd)){
            unsigned n = 0;
            {
                QObjectList *l = queryList("StatusLabel");
                QObjectListIt itObject(*l);
                QObject *obj;
                while ((obj=itObject.current()) != NULL) {
                    ++itObject;
                    StatusLabel *lbl = static_cast<StatusLabel*>(obj);
                    if (lbl->x() + lbl->width() > width())
                        n++;
                }
                delete l;
            }
            CommandDef *cmds = new CommandDef[n + 1];
            memset(cmds, 0, sizeof(CommandDef) * (n + 1));
            QObjectList *l = queryList("StatusLabel");
            QObjectListIt itObject(*l);
            QObject *obj;
            n = 0;
            while ((obj=itObject.current()) != NULL) {
                ++itObject;
                StatusLabel *lbl = static_cast<StatusLabel*>(obj);
                if (lbl->x() + lbl->width() > width()){
                    cmds[n].id = 1;
                    cmds[n].text = "_";
                    cmds[n].text_wrk = strdup(CorePlugin::m_plugin->clientName(lbl->m_client).utf8());
                    cmds[n].popup_id = lbl->m_id;
                    if (lbl->m_client->getState() == Client::Error){
                        cmds[n].icon = "error";
                    }else{
                        Protocol *protocol = lbl->m_client->protocol();
                        const CommandDef *cmd = protocol->description();
                        cmds[n].icon = cmd->icon;
                        for (cmd = protocol->statusList(); cmd->text; cmd++){
                            if (cmd->id == lbl->m_client->getStatus()){
                                cmds[n].icon = cmd->icon;
                                break;
                            }
                        }
                    }
                    n++;
                }
            }
            delete l;
            cmd->param = cmds;
            cmd->flags |= COMMAND_RECURSIVE;
            return e->param();
        }
        break;
    case EventClientsChanged:
        addClients();
        break;
    case EventClientChanged:{
            StatusLabel *lbl = findLabel((Client*)(e->param()));
            if (lbl)
                lbl->setPict();
            break;
        }
    case EventClientError:
        if (isVisible()){
            clientErrorData *data = (clientErrorData*)(e->param());
            if (data->code == AuthError)
                break;
            StatusLabel *lbl = findLabel(data->client);
            if (lbl == NULL)
                break;
            if (data->err_str && *data->err_str){
                QString msg = i18n(data->err_str);
                if (data->args)
                    msg = msg.arg(QString::fromUtf8(data->args));
                raiseWindow(topLevelWidget());
                BalloonMsg::message(msg, lbl);
                return e->param();
            }
        }
        break;
    case EventIconChanged:{
            QObjectList *l = queryList("StatusLabel");
            QObjectListIt itObject(*l);
            QObject *obj;
            while ((obj=itObject.current()) != NULL) {
                ++itObject;
                static_cast<StatusLabel*>(obj)->setPict();
            }
            delete l;
            break;
        }
    }
    return NULL;
}
Beispiel #30
0
static Bool layoutOrganicThumbs(CompScreen * s)
{
	CompWindow *w;
	int i, moMode;
	XRectangle workArea;

	SCALE_SCREEN(s);
	ADDON_SCREEN(s);

	moMode = ss->opt[SCALE_SCREEN_OPTION_MULTIOUTPUT_MODE].value.i;

	switch (moMode) {
	case SCALE_MOMODE_ALL:
		workArea = s->workArea;
		break;
	case SCALE_MOMODE_CURRENT:
	default:
		workArea = s->outputDev[s->currentOutputDev].workArea;
		break;
	}

	as->scale = 1.0f;

	qsort(ss->windows, ss->nWindows, sizeof(CompWindow *),
	      organicCompareWindows);

	for (i = 0; i < ss->nWindows; i++) {
		w = ss->windows[i];
		SCALE_WINDOW(w);

		sw->slot = &ss->slots[i];
		ss->slots[i].x1 = WIN_X(w) - workArea.x;
		ss->slots[i].y1 = WIN_Y(w) - workArea.y;
		ss->slots[i].x2 = WIN_X(w) + WIN_W(w) - workArea.x;
		ss->slots[i].y2 = WIN_Y(w) + WIN_H(w) - workArea.y;

		if (ss->slots[i].x1 < 0) {
			ss->slots[i].x2 += abs(ss->slots[i].x1);
			ss->slots[i].x1 = 0;
		}
		if (ss->slots[i].x2 > workArea.width - workArea.x) {
			ss->slots[i].x1 -=
			    abs(ss->slots[i].x2 - workArea.width);
			ss->slots[i].x2 = workArea.width - workArea.x;
		}

		if (ss->slots[i].y1 < 0) {
			ss->slots[i].y2 += abs(ss->slots[i].y1);
			ss->slots[i].y1 = 0;
		}
		if (ss->slots[i].y2 > workArea.height - workArea.y) {
			ss->slots[i].y1 -= abs(ss->slots[i].y2 -
					       workArea.height - workArea.y);
			ss->slots[i].y2 = workArea.height - workArea.y;
		}
	}

	ss->nSlots = ss->nWindows;

	layoutOrganicRemoveOverlap(s, workArea.width - workArea.x,
				   workArea.height - workArea.y);
	for (i = 0; i < ss->nWindows; i++) {
		w = ss->windows[i];
		SCALE_WINDOW(w);

		if (ss->type == ScaleTypeGroup)
			raiseWindow(ss->windows[i]);

		ss->slots[i].x1 += w->input.left + workArea.x;
		ss->slots[i].x2 += w->input.left + workArea.x;
		ss->slots[i].y1 += w->input.top + workArea.y;
		ss->slots[i].y2 += w->input.top + workArea.y;
		sw->adjust = TRUE;
	}

	return TRUE;
}