Пример #1
0
void CPlainWriteWindow::initActions() {
    insertKeyboardActions(actionCollection());

    QAction* action = actionCollection()->action(CResMgr::displaywindows::commentaryWindow::syncWindow::actionName);
    Q_ASSERT(action != 0);
    bool ok = QObject::connect(action, SIGNAL(triggered()),
                               this,   SLOT(saveCurrentText()));
    Q_ASSERT(ok);

    action = actionCollection()->action(CResMgr::displaywindows::writeWindow::saveText::actionName);
    Q_ASSERT(action != 0);
    ok = QObject::connect(action, SIGNAL(triggered()),
                          this,   SLOT(saveCurrentText()));
    Q_ASSERT(ok);

    action = actionCollection()->action(CResMgr::displaywindows::writeWindow::deleteEntry::actionName);
    Q_ASSERT(action != 0);
    ok = QObject::connect(action, SIGNAL(triggered()),
                          this,   SLOT(deleteEntry()));
    Q_ASSERT(ok);

    action = actionCollection()->action(CResMgr::displaywindows::writeWindow::restoreText::actionName);
    Q_ASSERT(action != 0);
    ok = QObject::connect(action, SIGNAL(triggered()),
                          this,   SLOT(restoreText()));
    Q_ASSERT(ok);
}
void Toolbar::changed( ItemPtr item )
{// normally a toolbar only has several buttons ( less than 30 ), always do a full refresh
	unsigned int index = 0;
	changed( index, rootItem() );
	++index;
	while( index < (unsigned int)sendMessage( TB_BUTTONCOUNT, 0, 0 ) )
	{
		static const unsigned int MAX_MENU_TEXT = 1024;
		char txtBuf[ MAX_MENU_TEXT + 1 ];
		TBBUTTONINFO info;
		memset( &info, 0, sizeof( info ) );
		info.cbSize = sizeof( info );
		info.dwMask = TBIF_BYINDEX | TBIF_COMMAND | TBIF_IMAGE | TBIF_LPARAM
			| TBIF_SIZE | TBIF_STATE | TBIF_STYLE | TBIF_TEXT;
		info.pszText = txtBuf;
		txtBuf[0] = 0;
		info.cchText = MAX_MENU_TEXT;
		sendMessage( TB_GETBUTTONINFO, index, (LPARAM)&info );
		if( ( info.fsStyle & BTNS_SEP ) && info.lParam )
			DestroyWindow( (HWND)info.lParam );
		sendMessage( TB_DELETEBUTTON , index, 0 );
	}
	restoreText();
	UpdateWindow( toolbar_ );
}
Пример #3
0
static int
restoreDbEntries(struct butm_tapeInfo *tapeInfoPtr,
		 struct rstTapeInfo *rstTapeInfoPtr)
{
    struct structDumpHeader netItemHeader, hostItemHeader;
    afs_int32 more = 1;
    afs_int32 taskId, code = 0;
    int count = 0;

    taskId = rstTapeInfoPtr->taskId;

    /* clear state for the buffer routine(s) */
    initTapeBuffering();

    code = butm_ReadFileBegin(tapeInfoPtr);
    if (code) {
	ErrorLog(0, taskId, code, tapeInfoPtr->error,
		 "Can't read FileBegin on tape\n");
	ERROR_EXIT(code);
    }

    /* get the first item-header */
    memset(&netItemHeader, 0, sizeof(netItemHeader));
    code =
	getTapeData(tapeInfoPtr, rstTapeInfoPtr, &netItemHeader,
		    sizeof(netItemHeader));
    if (code)
	ERROR_EXIT(code);
    structDumpHeader_ntoh(&netItemHeader, &hostItemHeader);

    while (more) {
	switch (hostItemHeader.type) {
	case SD_DBHEADER:
	    code =
		restoreDbHeader(tapeInfoPtr, rstTapeInfoPtr, &hostItemHeader);
	    if (code)
		ERROR_EXIT(code);
	    break;

	case SD_DUMP:
	    if (++count > 25) {	/*every 25 dumps, wait */
		waitDbWatcher();
		count = 0;
	    }
	    code =
		restoreDbDump(tapeInfoPtr, rstTapeInfoPtr, &hostItemHeader);
	    if (code)
		ERROR_EXIT(code);
	    break;

	case SD_TAPE:
	case SD_VOLUME:
	    ERROR_EXIT(-1);
	    break;

	case SD_TEXT_DUMPSCHEDULE:
	case SD_TEXT_VOLUMESET:
	case SD_TEXT_TAPEHOSTS:
	    code = restoreText(tapeInfoPtr, rstTapeInfoPtr, &hostItemHeader);
	    if (code)
		ERROR_EXIT(code);
	    break;

	case SD_END:
	    more = 0;
	    break;

	default:
	    TLog(taskId, "Unknown database header type %d\n",
		 hostItemHeader.type);
	    ERROR_EXIT(-1);
	    break;
	}
    }

    code = butm_ReadFileEnd(tapeInfoPtr);
    if (code) {
	ErrorLog(0, taskId, code, tapeInfoPtr->error,
		 "Can't read EOF on tape\n");
	ERROR_EXIT(code);
    }

    /* Mark tape as having been written */
    tapeEntryPtr->useKBytes =
	tapeInfoPtr->kBytes + (tapeInfoPtr->nBytes ? 1 : 0);
    tapeEntryPtr->flags = BUDB_TAPE_WRITTEN;

  error_exit:
    return (code);
}