void SludgeApplication::on_open() { if (!reallyClose()) return; GtkWidget *dialog; GtkFileFilter *filter; dialog = gtk_file_chooser_dialog_new ("Open File", NULL, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); filter = gtk_file_filter_new(); gtk_file_filter_set_name(filter, getFilterName()); gtk_file_filter_add_pattern(filter, getFilterPattern()); gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter); if (currentFolder[0] != 0) { gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), currentFolder); } if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { char *filename; filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); flipBackslashes(&filename); open(filename); g_free (filename); } gtk_widget_destroy (dialog); }
gboolean SludgeApplication::on_window1_delete_event() { if (reallyClose()) { gtk_main_quit (); return FALSE; } else { return TRUE; } }
void SludgeApplication::on_new() { if (!reallyClose()) return; init(FALSE); currentFilename[0] = 0; sprintf (currentShortname, "%s", getUntitledFilename()); gtk_window_set_title (GTK_WINDOW(theWindow), getWindowTitle()); fileChanged = FALSE; postNew (); }
KPagerMainWindow::KPagerMainWindow(QWidget *parent, const char *name) : DCOPObject("KPagerIface"), KMainWindow(parent, name) { m_reallyClose=false; m_pPager = new KPager(this, 0); setCentralWidget(m_pPager); KConfig *cfg = kapp->config(); cfg->setGroup("KPager"); // Update the last used geometry int w = cfg->readNumEntry(m_pPager->lWidth(),-1); int h = cfg->readNumEntry(m_pPager->lHeight(),-1); if (w > 0 && h > 0) resize(w,h); else resize(m_pPager->sizeHint()); // resize(cfg->readNumEntry(lWidth(),200),cfg->readNumEntry(lHeight(),90)); int xpos=cfg->readNumEntry("xPos",-1); int ypos=cfg->readNumEntry("yPos",-1); if (xpos > 0 && ypos > 0) move(xpos,ypos); else { // NETRootInfo ri( qt_xdisplay(), NET::WorkArea ); // NETRect rect=ri.workArea(1); // move(rect.pos.x+rect.size.width-m_pPager->width(), // rect.pos.y+rect.size.height-m_pPager->height()); // antonio:The above lines don't work. I should look at them when I have // more time move(kapp->desktop()->width()-m_pPager->sizeHint().width()-5,kapp->desktop()->height()-m_pPager->sizeHint().height()-25); } // Set the wm flags to this window KWin::setState( winId(), NET::StaysOnTop | NET::SkipTaskbar | NET::Sticky | NET::SkipPager ); KWin::setOnAllDesktops( winId(), true); if ( KWin::windowInfo( winId(), NET::WMWindowType, 0 ).windowType(NET::Normal) == NET::Normal ) { KWin::setType( winId(), NET::Utility ); } XWMHints *hints = XGetWMHints(x11Display(), winId()); if( hints == NULL ) hints = XAllocWMHints(); hints->input = false; hints->flags |= InputHint; XSetWMHints(x11Display(), winId(), hints); XFree(reinterpret_cast<char *>(hints)); timeout=new QTimer(this,"timeoutToQuit"); connect(timeout,SIGNAL(timeout()),this, SLOT(reallyClose())); }