Exemple #1
0
static void reset_tty(byte do_clear) {

    DState = ESnormal;
    if (*Flags & TTY_INVERTSCR)
	invert_screen();
    *Flags = TTY_AUTOWRAP;
    Effects = 0;
    
    Top	 = 0;
    Bottom = SizeY;

    ColText = Color = DefColor = COL(WHITE,BLACK);
    Underline = COL(HIGH|WHITE,BLACK);
    HalfInten = COL(HIGH|BLACK,BLACK);
    
    Win->Flags |= WINDOWFL_CURSOR_ON;
    Win->CursorType = LINECURSOR;

    TabStop[0] = 0x01010100;
    TabStop[1] = TabStop[2] = TabStop[3] = TabStop[4] = 0x01010101;
    
    nPar = 0;
    
    G = saveG = 0;
    /*
     * default to latin1 charset if CONF__UNICODE is enabled
     */
#ifdef CONF__UNICODE
    setCharset(G0 = saveG0 = LAT1_MAP);
#else
    setCharset(G0 = saveG0 = IBMPC_MAP);
#endif
    G1 = saveG1 = GRAF_MAP;

    utf = utf_count = utf_char = 0;
    
    /*
    bell_pitch = DEFAULT_BELL_PITCH;
    bell_duration = DEFAULT_BELL_DURATION;

    kbd_table.ledmode = LED_SHOW_FLAGS;
    kbd_table.ledflagstate = kbd_table.default_ledflagstate;
    */
    
    goto_xy(0,0);
    save_current();
    if (do_clear)
	csi_J(2);
}
Exemple #2
0
  NDBT_Attribute(const char* _name,
		 NdbDictionary::Column::Type _type,
		 int _length = 1,
		 bool _pk = false, 
		 bool _nullable = false,
		 CHARSET_INFO *cs= 0,
		 NdbDictionary::Column::StorageType storage = NdbDictionary::Column::StorageTypeMemory,
                 bool dynamic = false,
                 const void* defaultVal = NULL,
                 Uint32 defaultValBytes = 0):
    NdbDictionary::Column(_name)
  {
    assert(_name != 0);
    
    setType(_type);
    setLength(_length);
    setNullable(_nullable);
    setPrimaryKey(_pk);
    if (cs)
    {
      setCharset(cs);
    }
    setStorageType(storage);
    setDynamic(dynamic);
    setDefaultValue(defaultVal, defaultValBytes);
  }
Exemple #3
0
INLINE void restore_current(void) {
    goto_xy(saveX, saveY);
    ColText = saveColor;
    update_eff();
    *Flags &= ~TTY_NEEDWRAP;
    G  = saveG;
    G0 = saveG0;
    G1 = saveG1;
    setCharset(G ? G1 : G0);
}
// Reset text formatting parameters.
void Adafruit_Thermal::setDefault(){
  online();
  justify('L');
  inverseOff();
  doubleHeightOff();
  setLineHeight(30);
  boldOff();
  underlineOff();
  setBarcodeHeight(50);
  setSize('s');
  setCharset();
  setCodePage();
}
Exemple #5
0
  NDBT_Attribute(const char* _name,
		 NdbDictionary::Column::Type _type,
		 int _length = 1,
		 bool _pk = false, 
		 bool _nullable = false,
		 CHARSET_INFO *cs= 0,
		 NdbDictionary::Column::StorageType storage = NdbDictionary::Column::StorageTypeMemory):
    NdbDictionary::Column(_name)
  {
    assert(_name != 0);
    
    setType(_type);
    setLength(_length);
    setNullable(_nullable);
    setPrimaryKey(_pk);
    if (cs)
    {
      setCharset(cs);
    }
    setStorageType(storage);
  }
Exemple #6
0
CodecCombo::CodecCombo(const QString& _d, const QString& _k, QWidget* _p, const char* _n)
           : QComboBox(_p), mDomain(_d), mKey(_k)
{
	QStringList l;

	QString *charset = _list;
	while(! charset->isEmpty()) {
		l.append(*charset);
		charset++;
	}

	addItems(l);
	setEditable(false);

	QString _i = museeq->config(_d, _k);
	if(_i.isEmpty())
		_i = museeq->config("encoding", "network");

	setCharset(_i);

	connect(museeq, SIGNAL(configChanged(const QString&, const QString&, const QString&)), SLOT(slotConfigChanged(const QString&, const QString&, const QString&)));
	connect(this, SIGNAL(activated(const QString&)), SLOT(slotActivated(const QString&)));
}
Exemple #7
0
INLINE void csi_m(void) {
    dat i;
    udat effects = Effects;
    hwcol fg = COLFG(ColText), bg = COLBG(ColText);
    
    for (i=0; i<=nPar; i++) switch (Par[i]) {
      case 0:
	/* all attributes off */
	fg = COLFG(DefColor);
	bg = COLBG(DefColor);
	effects = 0;
	break;
      case 1:
	effects &= ~EFF_HALFINTENS;
	effects |= EFF_INTENSITY;
	break;
      case 2:
	effects &= ~EFF_INTENSITY;
	effects |= EFF_HALFINTENS;
	break;
      case 4:
	effects |= EFF_UNDERLINE;
	break;
      case 5:
	effects |= EFF_BLINK;
	break;
      case 7:
	effects |= EFF_REVERSE;
	break;
      case 10: /* ANSI X3.64-1979 (SCO-ish?)
		* Select primary font, don't display
		* control chars if defined, don't set
		* bit 8 on output.
		*/
	setCharset(G ? G1 : G0);
	*Flags &= ~(TTY_DISPCTRL | TTY_SETMETA);
	break;
      case 11: /* ANSI X3.64-1979 (SCO-ish?)
		* Select first alternate font, lets
		* chars < 32 be displayed as ROM chars.
		*/
	setCharset(IBMPC_MAP);
	*Flags |= TTY_DISPCTRL;
	*Flags &= ~TTY_SETMETA;
	break;
      case 12: /* ANSI X3.64-1979 (SCO-ish?)
		* Select second alternate font, toggle
		* high bit before displaying as ROM char.
		*/
	setCharset(IBMPC_MAP);
	*Flags |= TTY_DISPCTRL | TTY_SETMETA;
	break;
      case 21:
      case 22:
	effects &= ~(EFF_HALFINTENS|EFF_INTENSITY);
	break;
      case 24:
	effects &= ~EFF_UNDERLINE;
	break;
      case 25:
	effects &= ~EFF_BLINK;
	break;
      case 27:
	effects &= ~EFF_REVERSE;
	break;
      case 38: /* ANSI X3.64-1979 (SCO-ish?)
		* Enables underscore, white foreground
		* with white underscore
		* (Linux - use default foreground).
		*/
	fg = COLFG(DefColor);
	effects |= EFF_UNDERLINE;
	break;
      case 39: /* ANSI X3.64-1979 (SCO-ish?)
		* Disable underline option.
		* Reset colour to default? It did this
		* before...
		*/
	fg = COLFG(DefColor);
	effects &= ~EFF_UNDERLINE;
	break;
      case 49: /* restore default bg */
	bg = COLBG(DefColor);
	break;
      default:
	if (Par[i] >= 30 && Par[i] <= 37)
	    Par[i] -= 30,
	    fg = ANSI2VGA(Par[i]);
	else if (Par[i] >= 40 && Par[i] <= 47)
	    Par[i] -= 40,
	    bg = ANSI2VGA(Par[i]);
	break;
    }
    Effects = effects;
    ColText = COL(fg, bg);

    update_eff();
}
Exemple #8
0
int main(int ac, char **av, char **env)
{
	char *hostname;
	int is_command = 0;
	int is_sftp = 0;

	create_hash();
	if (ac == 3 && av[1] != NULL && av[2] != NULL && strcmp("-c", av[1]) == 0
			&& (strstr(av[2], "sftp-server") != NULL || strstr(av[2], "MySecureShell") != NULL))
		is_sftp = 1;
	else if (ac >= 3 && av[1] != NULL && av[2] != NULL && strcmp("-c", av[1]) == 0)
		is_command = 1;
	else
		parse_args(ac, av);
	hostname = get_ip(0);
	(void) setenv("SSH_IP", hostname, 1);
	free(hostname);
	FileSpecInit();
	load_config(0);
	if (is_sftp == 1)
	{
		tGlobal	*params;
		char	*ptr;
		int		max, fd, sftp_version;

		hostname = get_ip(hash_get_int("ResolveIP"));
		if (hostname == NULL)
		{
			perror("unable to resolve ip");
			exit(16);
		}
		params = calloc(1, sizeof(*params));
		if (params == NULL)
		{
			perror("unable to alloc memory");
			exit(15);
		}
		ptr = hash_get("Home");
		params->home = strdup(ptr == NULL ? "{error home}" : ptr);
		ptr = hash_get("User");
		params->user = strdup(ptr == NULL ? "{error user}" : ptr);
		params->ip = strdup(hostname == NULL ? "{error ip}" : hostname);
		params->portSource = get_port_client();

		params->who = SftpWhoGetStruct(1);
		if (params->who != NULL)
		{
			params->who->time_begin = (u_int32_t) time(0);
			params->who->pid = (u_int32_t) getpid();
			(void) strncat(params->who->home, params->home, sizeof(params->who->home) - 1);
			(void) strncat(params->who->user, params->user, sizeof(params->who->user) - 1);
			(void) strncat(params->who->ip, params->ip, sizeof(params->who->ip) - 1);
		}
		//check if the server is up and user is not admin
		if ((fd = open(SHUTDOWN_FILE, O_RDONLY)) >= 0)
		{
			xclose(fd);
			if (hash_get_int("IsAdmin") == 0 && hash_get_int("IsSimpleAdmin") == 0)
			{
				SftpWhoReleaseStruct(params->who);
				delete_hash();
				FileSpecDestroy();
				exit(0);
			}
		}
		max = hash_get_int("LogSyslog");
		if (hash_get("LogFile") != NULL)
			mylog_open(strdup(hash_get("LogFile")), max);
		else
			mylog_open(strdup(MSS_LOG), max);
		if (params->who == NULL)
		{
			mylog_printf(MYLOG_ERROR, "[%s]Server '%s' reached maximum connexion (%i clients)",
					hash_get("User"), hash_get("SERVER_IP"), SFTPWHO_MAXCLIENT);
			SftpWhoReleaseStruct(NULL);
			delete_hash();
			FileSpecDestroy();
			mylog_close_and_free();
			exit(14);
		}
		max = hash_get_int("LimitConnectionByUser");
		if (max > 0 && count_program_for_uid(hash_get("User")) > max)
		{
			mylog_printf(MYLOG_ERROR, "[%s]Too many connection for this account",
					hash_get("User"));
			SftpWhoReleaseStruct(params->who);
			delete_hash();
			FileSpecDestroy();
			exit(10);
		}
		max = hash_get_int("LimitConnectionByIP");
		if (max > 0 && count_program_for_ip(hostname) > max)
		{
			mylog_printf(MYLOG_ERROR, "[%s]Too many connection for this IP : %s",
					hash_get("User"), hostname);
			SftpWhoReleaseStruct(params->who);
			delete_hash();
			FileSpecDestroy();
			exit(11);
		}
		max = hash_get_int("LimitConnection");
		if (max > 0 && count_program_for_uid(NULL) > max)
		{
			mylog_printf(MYLOG_ERROR, "[%s]Too many connection for the server : %s",
					hash_get("User"), hash_get("SERVER_IP"));
			SftpWhoReleaseStruct(params->who);
			delete_hash();
			FileSpecDestroy();
			exit(12);
		}
		if (hash_get_int("DisableAccount"))
		{
			mylog_printf(MYLOG_ERROR, "[%s]Account is closed", hash_get("User"));
			SftpWhoReleaseStruct(params->who);
			delete_hash();
			FileSpecDestroy();
			exit(13);
		}

		params->flagsGlobals
				|= (hash_get_int("StayAtHome") ? SFTPWHO_STAY_AT_HOME : 0)
						+ (hash_get_int("VirtualChroot") ? SFTPWHO_VIRTUAL_CHROOT : 0)
						+ (hash_get_int("ResolveIP") ? SFTPWHO_RESOLVE_IP : 0)
						+ (hash_get_int("IgnoreHidden") ? SFTPWHO_IGNORE_HIDDEN : 0)
						+ (hash_get_int("DirFakeUser") ? SFTPWHO_FAKE_USER : 0)
						+ (hash_get_int("DirFakeGroup") ? SFTPWHO_FAKE_GROUP : 0)
						+ (hash_get_int("DirFakeMode") ? SFTPWHO_FAKE_MODE : 0)
						+ (hash_get_int("HideNoAccess") ? SFTPWHO_HIDE_NO_ACESS : 0)
						+ (hash_get_int("ByPassGlobalDownload") ? SFTPWHO_BYPASS_GLB_DWN : 0)
						+ (hash_get_int("ByPassGlobalUpload") ? SFTPWHO_BYPASS_GLB_UPL : 0)
						+ (hash_get_int("ShowLinksAsLinks") ? SFTPWHO_LINKS_AS_LINKS : 0)
						+ (hash_get_int("IsAdmin") ? SFTPWHO_IS_ADMIN : 0)
						+ (hash_get_int("IsSimpleAdmin") ? SFTPWHO_IS_SIMPLE_ADMIN : 0)
						+ (hash_get_int("CanChangeRights") ? SFTPWHO_CAN_CHG_RIGHTS : 0)
						+ (hash_get_int("CanChangeTime") ? SFTPWHO_CAN_CHG_TIME : 0)
						+ (hash_get_int("CreateHome") ? SFTPWHO_CREATE_HOME : 0);
		params->flagsDisable
				= (hash_get_int("DisableRemoveDir") ? SFTP_DISABLE_REMOVE_DIR : 0)
						+ (hash_get_int("DisableRemoveFile") ? SFTP_DISABLE_REMOVE_FILE : 0)
						+ (hash_get_int("DisableReadDir") ? SFTP_DISABLE_READ_DIR : 0)
						+ (hash_get_int("DisableReadFile") ? SFTP_DISABLE_READ_FILE : 0)
						+ (hash_get_int("DisableWriteFile") ? SFTP_DISABLE_WRITE_FILE : 0)
						+ (hash_get_int("DisableSetAttribute") ? SFTP_DISABLE_SET_ATTRIBUTE : 0)
						+ (hash_get_int("DisableMakeDir") ? SFTP_DISABLE_MAKE_DIR : 0)
						+ (hash_get_int("DisableRename") ? SFTP_DISABLE_RENAME : 0)
						+ (hash_get_int("DisableSymLink") ? SFTP_DISABLE_SYMLINK : 0)
						+ (hash_get_int("DisableOverwrite") ? SFTP_DISABLE_OVERWRITE : 0)
						+ (hash_get_int("DisableStatsFs") ? SFTP_DISABLE_STATSFS : 0);
		params->who->status |= params->flagsGlobals;
		_sftpglobal->download_max = (u_int32_t) hash_get_int("GlobalDownload");
		_sftpglobal->upload_max = (u_int32_t) hash_get_int("GlobalUpload");
		if (hash_get_int("Download") > 0)
		{
			params->download_max = (u_int32_t) hash_get_int("Download");
			params->who->download_max = params->download_max;
		}
		if (hash_get_int("Upload") > 0)
		{
			params->upload_max = (u_int32_t) hash_get_int("Upload");
			params->who->upload_max = params->upload_max;
		}
		if (hash_get_int("IdleTimeOut") > 0)
			params->who->time_maxidle = (u_int32_t) hash_get_int("IdleTimeOut");
		if (hash_get_int("DirFakeMode") > 0)
			params->dir_mode = (u_int32_t) hash_get_int("DirFakeMode");
		sftp_version = hash_get_int("SftpProtocol");
		if (hash_get_int("ConnectionMaxLife") > 0)
			params->who->time_maxlife = (u_int32_t) hash_get_int("ConnectionMaxLife");
		if (hash_get("ExpireDate") != NULL)
		{
			struct tm tm;
			time_t currentTime, maxTime;

			if (strptime((const char *) hash_get("ExpireDate"),
					"%Y-%m-%d %H:%M:%S", &tm) != NULL)
			{
				maxTime = mktime(&tm);
				currentTime = time(NULL);
				if (currentTime > maxTime) //time elapsed
				{
					mylog_printf(MYLOG_ERROR, "[%s]Account has expired : %s",
							hash_get("User"), hash_get("ExpireDate"));
					SftpWhoReleaseStruct(params->who);
					delete_hash();
					mylog_close_and_free();
					exit(15);
				}
				else
				{ //check if expireDate < time_maxlife
					currentTime = maxTime - currentTime;
					if ((u_int32_t) currentTime < params->who->time_maxlife)
						params->who->time_maxlife = (u_int32_t) currentTime;
				}
			} DEBUG((MYLOG_DEBUG, "[%s][%s]ExpireDate time to rest: %i",
							params->who->user, params->who->ip, params->who->time_maxlife));
		}

		if (hash_exists("MaxOpenFilesForUser") == MSS_TRUE)
			params->max_openfiles = hash_get_int("MaxOpenFilesForUser");
		if (hash_exists("MaxReadFilesForUser") == MSS_TRUE)
			params->max_readfiles = hash_get_int("MaxReadFilesForUser");
		if (hash_exists("MaxWriteFilesForUser") == MSS_TRUE)
			params->max_writefiles = hash_get_int("MaxWriteFilesForUser");

		if (hash_get_int("MinimumRightsDirectory") > 0)
			params->minimum_rights_directory = hash_get_int(
					"MinimumRightsDirectory");
		if (hash_get_int("MinimumRightsFile") > 0)
			params->minimum_rights_file = hash_get_int("MinimumRightsFile");
		if (hash_get_int("MaximumRightsDirectory") > 0)
			params->maximum_rights_directory = hash_get_int(
					"MaximumRightsDirectory");
		else
			params->maximum_rights_directory = 07777;
		if (hash_get_int("MaximumRightsFile") > 0)
			params->maximum_rights_file = hash_get_int("MaximumRightsFile");
		else
			params->maximum_rights_file = 07777;
		if (hash_get_int("DefaultRightsDirectory") > 0)
			params->default_rights_directory = hash_get_int("DefaultRightsDirectory");
		else
			params->default_rights_directory = 0755;
		if (hash_get_int("DefaultRightsFile") > 0)
			params->default_rights_file = hash_get_int("DefaultRightsFile");
		else
			params->default_rights_file = 0644;
		if (hash_get_int("ForceRightsDirectory") > 0)
		{
			params->minimum_rights_directory = hash_get_int("ForceRightsDirectory");
			params->maximum_rights_directory = params->minimum_rights_directory;
		}
		if (hash_get_int("ForceRightsFile") > 0)
		{
			params->minimum_rights_file = hash_get_int("ForceRightsFile");
			params->maximum_rights_file = params->minimum_rights_file;
		}

		if (hash_get("ForceUser") != NULL)
			params->force_user = strdup(hash_get("ForceUser"));
		if (hash_get("ForceGroup") != NULL)
			params->force_group = strdup(hash_get("ForceGroup"));

		if (hash_get("Charset") != NULL)
			setCharset(hash_get("Charset"));
		if (hash_get("ApplyFileSpec") != NULL)
			FileSpecActiveProfils(hash_get("ApplyFileSpec"), 0);
		delete_hash();
		if (hostname != NULL)
			free(hostname);
		params->current_user = getuid();
		params->current_group = getgid();
		return (SftpMain(params, sftp_version));
	}
	else
	{
		char *ptr;

		if (getuid() != geteuid())
		//if we are in utset byte mode then we restore user's rights to avoid security problems
		{
			if (seteuid(getuid()) == -1 || setegid(getgid()) == -1)
			{
				perror("revoke root rights");
				exit(1);
			}
		}
		ptr = hash_get("Shell");
		if (ptr != NULL)
		{
			if (strcmp(ptr, av[0]) != 0)
			{
				av[0] = ptr;
				if (is_command == 1)
				{
					size_t	len = 0;
					char	**new_env;
					char	*cmd, *envVar;
					int		i;

					for (i = 2; i < ac; i++)
						len += strlen(av[i]);
					cmd = malloc(len + ac + 1);
					envVar = malloc(len + ac + 1 + 21);
					cmd[0] = '\0';
					for (i = 2; i < ac; i++)
					{
						if (i > 2)
							strcat(cmd, " ");
						strcat(cmd, av[i]);
					}
					av[2] = cmd;
					av[3] = NULL;
					strcpy(envVar, "SSH_ORIGINAL_COMMAND=");
					strcat(envVar, cmd);
					len = 0;
					for (i = 0; env[i] != NULL; i++)
						len++;
					new_env = calloc(len + 2, sizeof(*new_env));
					for (i = 0; i < len; i++)
						new_env[i] = env[i];
					new_env[len] = envVar;
					(void) execve(av[0], av, new_env);
				}
				else
					(void) execve(av[0], av, env);
				perror("execute shell");
			}
			else
				(void) fprintf(stderr, "You cannot specify MySecureShell has shell (in the MySecureShell configuration) !");
		}
		else
			(void) fprintf(stderr, "Shell access is disabled !");
		exit(1);
	}
}
Exemple #9
0
void
CodecCombo::slotConfigChanged(const QString& domain, const QString& key, const QString& value)
{
	if(domain == mDomain && key == mKey)
		setCharset(value);
}
Exemple #10
0
QPixmap markerPixmap(const QColor& color, const QColor& bgColor) {
	// create unique string-name for color combinations
	QString cacheName(color.name()+bgColor.name());
	QPixmap px(16, 16);

	// The method signature was changed: it's
	// bool QPixmapCache::find ( const QString & key, QPixmap & pm ) in Qt <= 4.5
	// and
	// bool QPixmapCache::find ( const QString & key, QPixmap * pm ) in Qt >= 4.6
#if QT_VERSION >= 0x040600
	if ( QPixmapCache::find(cacheName, &px) ) {
#else
	if ( QPixmapCache::find(cacheName, px) ) {
#endif
		return px;
	}

	px.fill(bgColor);

	QPainter p(&px);
	// As we are using pixmap cache for most pixmap access
	// we can use more resource and time consuming rendering
	// to get better results (smooth rounded bullet in this case).
	// Remember: painting is performed only once per running juffed
	//           in the ideal case.
	p.setRenderHint(QPainter::Antialiasing);

	int red   = color.red();
	int green = color.green();
	int blue  = color.blue();

	QColor light(red + (255 - red) / 2, green + (255 - green) / 2, blue + (255 - blue) / 2);
	QColor dark(red / 2, green / 2, blue / 2);

	QRadialGradient gr(0.4, 0.4, 0.5, 0.4, 0.4);
	gr.setCoordinateMode(QGradient::ObjectBoundingMode);
	gr.setColorAt(0, light);
	gr.setColorAt(1, dark);
	p.setPen(dark);
	p.setBrush(gr);
	p.drawEllipse(1, 1, 14, 14);

	p.end();

	QPixmapCache::insert(cacheName, px);
	return px;
}

class SciDoc::Interior {
public:
	Interior(QWidget* w) {
//		LOGGER;

		curEdit_ = NULL;

		spl_ = new QSplitter(Qt::Vertical);
		QVBoxLayout* vBox = new QVBoxLayout();
		vBox->setContentsMargins(0, 0, 0, 0);
		vBox->addWidget(spl_);
		w->setLayout(vBox);

		edit1_ = createEdit();
		edit2_ = createEdit();
		spl_->addWidget(edit1_);
		spl_->addWidget(edit2_);
		edit1_->setDocument(edit2_->document());
		w->setFocusProxy(spl_);
		spl_->setSizes(QList<int>() << 0 << spl_->height());
		
		hlTimer_ = new QTimer( w );
		hlTimer_->setSingleShot( true );
		connect(hlTimer_, SIGNAL(timeout()), w, SLOT(highlightWord()));
	}

	JuffScintilla* createEdit() {
//		LOGGER;
		JuffScintilla* edit = new JuffScintilla();
		edit->setFocusPolicy(Qt::ClickFocus);
		edit->setUtf8(true);
		edit->setFolding(QsciScintilla::BoxedTreeFoldStyle);
		edit->setAutoIndent(true);
		edit->setBraceMatching(QsciScintilla::SloppyBraceMatch);

		// margins
		edit->setMarginLineNumbers(0, false);
		edit->setMarginLineNumbers(1, true);
		edit->setMarginSensitivity(0, true);
		edit->setMarginWidth(0, 20);
		edit->setMarginWidth(2, 12);

		// markers
		edit->markerDefine(QsciScintilla::Background, 2);
		//	Set the 0th margin accept markers numbered 1 and 2
		//	Binary mask for markers 1 and 2 is 00000110 ( == 6 )
		edit->setMarginMarkerMask(0, 6);
		edit->setMarginMarkerMask(1, 0);

		return edit;
	}

	void setCurrentEdit(JuffScintilla* edit) {
//		LOGGER;

		curEdit_ = edit;
		spl_->setFocusProxy(edit);
	}

	JuffScintilla* edit1_;
	JuffScintilla* edit2_;
	JuffScintilla* curEdit_;
	QString syntax_;
	QSplitter* spl_;
	QTimer* hlTimer_;
};

SciDoc::SciDoc(const QString& fileName) : Juff::Document(fileName) {
//	LOGGER;

	int_ = new Interior(this);

	JuffScintilla* edits[] = { int_->edit1_, int_->edit2_ };
	for ( int i = 0; i < 2; ++i) {
		JuffScintilla* edit = edits[i];
		connect(edit, SIGNAL(cursorPositionChanged(int, int)), this, SLOT(onCursorMoved(int, int)));
	//	connect(int_->edit1_, SIGNAL(contextMenuCalled(int, int)), this, SIGNAL(contextMenuCalled(int, int)));
		connect(edit, SIGNAL(marginClicked(int, int, Qt::KeyboardModifiers)), SLOT(onMarginClicked(int, int, Qt::KeyboardModifiers)));
		connect(edit, SIGNAL(focusReceived()), SLOT(onEditFocused()));
		connect(edit, SIGNAL(markersMenuRequested(const QPoint&)), SIGNAL(markersMenuRequested(const QPoint&)));
		connect(edit, SIGNAL(escapePressed()), SIGNAL(escapePressed()));
	}
	connect(int_->edit1_, SIGNAL(modificationChanged(bool)), this, SIGNAL(modified(bool)));
	connect(int_->edit1_, SIGNAL(linesChanged()), SLOT(onLineCountChanged()));
	connect(int_->edit1_, SIGNAL(textChanged()), this, SIGNAL(textChanged()));

	QString lexName = "none";
	SciDoc::Eol eol = guessEol(fileName);
	std::pair<bool,int> indentation = guessIndentation(fileName);
	if ( !fileName.isEmpty() && !isNoname() ) {
		QString codecName = Document::guessCharset(fileName);
		if ( !codecName.isEmpty() )
			setCharset(codecName);
		readFile();
		setEol(eol);
		setIndentationsUseTabs(indentation.first);
		setTabWidth(indentation.second);
		int_->edit1_->setModified(false);

		//	syntax highlighting
		lexName = LexerStorage::instance()->lexerName(fileName);
	}
	else {
		setEol(eol);
		setIndentationsUseTabs(indentation.first);
		setTabWidth(indentation.second);
	}
	
	
	
	
	setLexer(lexName);

	applySettings();

	QAction* hlWordAct = new QAction("", this);
	hlWordAct->setShortcut(QKeySequence("Ctrl+H"));
	connect(hlWordAct, SIGNAL(triggered()), SLOT(highlightWord()));
	addAction(hlWordAct);
}

/*SciDoc::SciDoc(Juff::Document* doc) : Juff::Document(doc) {
	SciDoc* d = qobject_cast<SciDoc*>(doc);
	if ( d != 0 ) {
		int_->edit1_->setDocument(d->int_->edit1_->document());
		int_->edit2_->setDocument(d->int_->edit2_->document());
	}
}*/

SciDoc::~SciDoc() {
	delete int_;
}

QString SciDoc::type() const {
	return "QSci";
}

bool SciDoc::supportsAction(Juff::ActionID id) const {
	switch (id) {
		case Juff::FileClone : return true;
		default :              return Juff::Document::supportsAction(id);
	}
}

/*Juff::Document* SciDoc::createClone() {
	if ( hasClone() )
		return NULL;
	else
		return new SciDoc(this);
}

void SciDoc::updateClone() {
	LOGGER;

//	SciDoc* cln = qobject_cast<SciDoc*>(clone());
//	if ( cln != 0 ) {
//		if ( cln->int_->syntax_ != int_->syntax_ ) {
//			cln->int_->syntax_ = int_->syntax_;
//			QsciLexer* lexer = LexerStorage::instance()->lexer(int_->syntax_);
//			cln->int_->edit1_->setLexer(lexer);
//			cln->int_->edit2_->setLexer(lexer);
//		}
//	}

	Juff::Document::updateClone();
}*/

void SciDoc::init() {
	int_->setCurrentEdit(int_->edit2_);
}
Exemple #11
0
void AtOptions::factoryDefaults()
{
    echo = true;
    backspace = 0x08;
    terminator = 0x0D;
    response = 0x0A;

    suppressResults = false;
    verboseResults = true;
    extendedErrors = 0;

    setCharset( "GSM" );

    cring = false;
    ccwa = false;
    clip = false;
    qcam = false;
    cind = 0;
    cmer = 1;
    qsq = false;
    qbc = false;
    creg = 0;
    cr = false;
    colp = false;
    clae = false;
    cssi = false;
    cssu = false;
    ccwv = false;
    cccm = false;
    lastTimeCCCM = QDateTime::currentDateTime();

    cusd = false;
    cmod = 0;
    csns = 0;

    contextSet = false;
    apn = "internet";

    csgt = false;
    greetingText = "";

    phoneStore = "EN";
    //phoneStorePw = "";

    cbstSpeed = -1;
    cbstName = -1;
    cbstCe = -1;

    cpls = 0;
    cpolFormat = 2;
    //cpolLastIndex = 0;
    dateFormat = 1;
    auxDateFormat = 1;
    timeFormat = 1;
    mtDateTimeOffset = 0;
    mtTimeZoneSeconds = 0;

    csvm = false;
    ignore_ath = false;
    ignore_drop_dtr = true;

    smsService = 0;
    messageFormat = false;
    csdh = false;
}