KEditProjectDialog::KEditProjectDialog(QWidget *parent) :QDialog(parent) , _M_ui (new Ui::KEditProjectDialog()) { _M_ui->setupUi(this); setup_actions(); }
gboolean mail_browser_init (GtkUIManager *ui_manager, EMailBrowser *browser) { setup_actions (E_MAIL_READER (browser), ui_manager); return TRUE; }
// --------------------------------------------------------------------------------- KDayView::KDayView ( QWidget *parent ) : QWidget ( parent ) , _M_ui ( new Ui::KDayView ( ) ) { _M_ui->setupUi ( this ); _M_ui->main_splitter->setSizes ( QList<int>() << 100 << 500 ); setup_actions(); on_selected_day_changed(); }
// --------------------------------------------------------------------------------- // private stuff: // --------------------------------------------------------------------------------- void KReportTable::init() { _M_data_model = new KReportTableModel ( this ); _M_sort_model = new QSortFilterProxyModel ( this ); _M_sort_model->setSortRole(KReportTableModel::SortRole); _M_sort_model->setSourceModel ( _M_data_model ); this->setModel ( _M_sort_model ); setup_actions(); }
static void startup(GApplication *gapp) { AgApp *app = AG_APP(gapp); G_APPLICATION_CLASS(ag_app_parent_class)->startup(gapp); setup_actions(app); setup_accelerators(app); }
gboolean mail_shell_view_init (GtkUIManager *ui_manager, EShellView *shell_view) { EShellContent *shell_content; shell_content = e_shell_view_get_shell_content (shell_view); setup_actions (E_MAIL_READER (shell_content), ui_manager); return TRUE; }
KEditActionTemplateDialog::KEditActionTemplateDialog(QWidget *parent) :KDialog(parent) , _M_ui(new Ui::KEditActionTemplateDialog()) , _M_current_template(NullActionTemplate()) { QWidget *w = new QWidget(this); _M_ui->setupUi(w); setMainWidget(w); setButtons(Ok | Cancel); setCaption(i18n("Favorite")); _M_ui->icon->setIconType(KIconLoader::NoGroup, KIconLoader::Emote); setup_actions(); }
EditorContextMenu::EditorContextMenu(QWidget *parent) : QMenu(parent) { setup_actions(); setup_signals(); setup_menu(); }
/* Each of stdin/stdout/stderr take in a pointer to a file descriptor. *ptr should be: -1 -> use the existing stdin/stdout -2 -> close the file descriptor -3 -> create a pipe and return the parent's end >0 -> use this file descriptor When this function returns, any file descriptors with a negative value indicating a pipe should be created (-3) will have their value replaced with the new pipe file descriptor. executable == NULL or "" -> search the path for argv[0] */ static qioerr qio_do_openproc(const char** argv, const char** envp, const char* executable, int* stdin_fd, int* stdout_fd, int* stderr_fd, int64_t *pid_out) { qioerr err; int rc; pid_t pid = 0; //struct popen_file* pfl = NULL; int in_pipe[2]; int out_pipe[2]; int err_pipe[2]; posix_spawn_file_actions_t actions; bool inited_actions = false; bool hasactions = false; const char* progname; progname = argv[0]; if( executable && executable[0] ) progname = executable; in_pipe[0] = in_pipe[1] = -1; out_pipe[0] = out_pipe[1] = -1; err_pipe[0] = err_pipe[1] = -1; STARTING_SLOW_SYSCALL; // Create pipes if( *stdin_fd == QIO_FD_PIPE || *stdin_fd == QIO_FD_BUFFERED_PIPE ) { rc = pipe(in_pipe); if( rc != 0 ) { err = qio_int_to_err(errno); goto error; } } if( *stdout_fd == QIO_FD_PIPE || *stdout_fd == QIO_FD_BUFFERED_PIPE ) { rc = pipe(out_pipe); if( rc != 0 ) { err = qio_int_to_err(errno); goto error; } } if( *stderr_fd == QIO_FD_PIPE || *stderr_fd == QIO_FD_BUFFERED_PIPE ) { rc = pipe(err_pipe); if( rc != 0 ) { err = qio_int_to_err(errno); goto error; } } // pipe[0] is the read end of the pipe // pipe[1] is the write end // fd 0 is stdin, 1 is stdout, 2 is stderr. // In order for Cygwin support to work, because Windows // doesn't have a 'fork' call, we use posix_spawn. // Note that posix_spawn *might* be faster on Linux if // we don't specify any file actions, since it can use // vfork and so avoid duplicating page tables. // To request vfork for posix_spawn on linux/glibc, // set the spawn attr POSIX_SPAWN_USEVFORK. // It is unclear whether or not the linux implementation // will work correctly when combining POSIX_SPAWN_USEVFORK // with file actions (e.g. to make a pipe for stdin/stdout). // If we seek to improve performance on linux, here are some options: // * POSIX_SPAWN_USEVFORK // * madvise(MADV_DONTFORK) on the Chapel heap // * implement fork/dup/exec with clone instead of fork on linux // (clone can avoid copying page tables). // Note: posix_spawn can use file descriptors that have // close-on-exec set as long as they are dup'd in a file action. rc = posix_spawn_file_actions_init(&actions); if( rc ) { err = qio_int_to_err(errno); goto error; } inited_actions = true; hasactions = false; err = setup_actions(&actions, stdin_fd, in_pipe, 0, true, &hasactions); if( err ) goto error; err = setup_actions(&actions, stdout_fd, out_pipe, 1, false, &hasactions); if( err ) goto error; // handle QIO_FD_TO_STDOUT if( *stderr_fd == QIO_FD_TO_STDOUT && (*stdout_fd == QIO_FD_PIPE || *stdout_fd == QIO_FD_BUFFERED_PIPE) ) { // forward stderr to stdout. err = setup_actions(&actions, stderr_fd, out_pipe, 2, false, &hasactions); if( err ) goto error; } else { if( *stderr_fd == QIO_FD_TO_STDOUT ) { if( *stdout_fd == QIO_FD_FORWARD ) { *stderr_fd = 1; // forward to parent's stdout. } else { // e.g. it's a file descriptor number. *stderr_fd = *stdout_fd; } } err = setup_actions(&actions, stderr_fd, err_pipe, 2, false, &hasactions); if( err ) goto error; } // spawn the subprogram, searching the path, returning the pid in pid rc = posix_spawnp(&pid, progname, hasactions?(&actions):(NULL), /* file actions */ NULL, /* attributes */ (char*const*) argv, // Use the current environment if none was specified. (envp==NULL)?(environ):((char*const*) envp) ); if( rc != 0 ) { err = qio_int_to_err(rc); goto error; } // destroy file actions, ignoring return code. posix_spawn_file_actions_destroy(&actions); inited_actions = false; // close the child-side of pipes. Return the parent side. if( in_pipe[0] != -1 ) { close(in_pipe[0]); *stdin_fd = in_pipe[1]; } if( out_pipe[0] != -1 ) { close(out_pipe[1]); *stdout_fd = out_pipe[0]; } if( err_pipe[0] != -1 ) { close(err_pipe[1]); *stderr_fd = err_pipe[0]; } // return the pid. *pid_out = (int64_t) pid; DONE_SLOW_SYSCALL; return 0; error: DONE_SLOW_SYSCALL; // intentionally ignoring error returns here... if( inited_actions ) posix_spawn_file_actions_destroy(&actions); if( in_pipe[0] ) close(in_pipe[0]); if( in_pipe[1] ) close(in_pipe[1]); if( out_pipe[0] ) close(out_pipe[0]); if( out_pipe[1] ) close(out_pipe[1]); if( err_pipe[0] ) close(err_pipe[0]); if( err_pipe[1] ) close(err_pipe[1]); return err; }