| 1186 | | #if 0 |
| 1187 | | qDebug("closeEvent() visible %d", isVisible()); |
| 1188 | | qDebug("geometry: x: %d y: %d, w: %d, h: %d", geometry().x(), geometry().y(), geometry().width(), geometry().height()); |
| 1189 | | qDebug("x: %d, y: %d, w: %d, h: %d", x(), y(), size().width(), size().height()); |
| 1190 | | qDebug(" toGlobal: x %d, y %d", mapToGlobal(QPoint(0,0)).x(), mapToGlobal(QPoint(0,0)).y()); |
| 1191 | | #endif |
| 1192 | | |
| 1193 | | if(isVisible() && positionChanges > 1) |
| 1194 | | { |
| 1195 | | // save window position and size |
| 1196 | | char buf[MAX_FILENAME_LEN]; |
| 1197 | | snprintf(buf, MAX_FILENAME_LEN, "%s/" QTGUI_CONFIGFILE, BASE_DIR); |
| 1198 | | buf[MAX_FILENAME_LEN - 1] = '\0'; |
| 1199 | | CIniFile licqConf(INI_FxALLOWxCREATE | INI_FxWARN); |
| 1200 | | // need some more error checking here... |
| 1201 | | licqConf.LoadFile(buf); |
| 1202 | | |
| 1203 | | licqConf.SetSection("geometry"); |
| 1204 | | // I'm not sure if we should really test for negative values... |
| 1205 | | licqConf.WriteNum("x", static_cast<short>(x())); |
| 1206 | | licqConf.WriteNum("y", static_cast<short>(y())); |
| 1207 | | licqConf.WriteNum("h", (unsigned short)(size().height() < 0 ? 0 : (m_bInMiniMode ? m_nRealHeight : size().height()))); |
| 1208 | | licqConf.WriteNum("w", (unsigned short)(size().width() < 0 ? 0 : size().width())); |
| 1209 | | |
| 1210 | | #if 0 |
| 1211 | | licqConf.SetSection("floaties"); |
| 1212 | | licqConf.WriteNum("Num", (unsigned short)CUserView::floaties->size()); |
| 1213 | | unsigned short i = 0; |
| 1214 | | char key[32]; |
| 1215 | | for (; i < CUserView::floaties->size(); ) |
| 1216 | | { |
| 1217 | | CUserView* iter = CUserView::floaties->at(i); |
| 1218 | | sprintf(key, "Floaty%d.Ppid", i); |
| 1219 | | licqConf.WriteNum(key, static_cast<CUserViewItem*>(iter->firstChild())->ItemPPID()); |
| 1220 | | sprintf(key, "Floaty%d.Uin", i); |
| 1221 | | licqConf.WriteStr(key, static_cast<CUserViewItem*>(iter->firstChild())->ItemId()); |
| 1222 | | sprintf(key, "Floaty%d.X", i); |
| 1223 | | licqConf.WriteNum(key, (unsigned short)(iter->x() > 0 ? iter->x() : 0)); |
| 1224 | | sprintf(key, "Floaty%d.Y", i); |
| 1225 | | licqConf.WriteNum(key, (unsigned short)(iter->y() > 0 ? iter->y() : 0)); |
| 1226 | | sprintf(key, "Floaty%d.W", i); |
| 1227 | | licqConf.WriteNum(key, (unsigned short)iter->width()); |
| 1228 | | i++; |
| 1229 | | } |
| 1230 | | #endif |
| 1231 | | |
| 1232 | | licqConf.FlushFile(); |
| 1233 | | licqConf.CloseFile(); |
| 1234 | | } |
| 1235 | | |
| | 2877 | if (isVisible() && positionChanges) |
| | 2878 | { |
| | 2879 | // save window position and size |
| | 2880 | char buf[MAX_FILENAME_LEN]; |
| | 2881 | snprintf(buf, MAX_FILENAME_LEN, "%s/" QTGUI_CONFIGFILE, BASE_DIR); |
| | 2882 | buf[MAX_FILENAME_LEN - 1] = '\0'; |
| | 2883 | CIniFile licqConf(INI_FxALLOWxCREATE | INI_FxWARN); |
| | 2884 | // need some more error checking here... |
| | 2885 | licqConf.LoadFile(buf); |
| | 2886 | |
| | 2887 | licqConf.SetSection("geometry"); |
| | 2888 | // I'm not sure if we should really test for negative values... |
| | 2889 | licqConf.WriteNum("x", static_cast<short>(x())); |
| | 2890 | licqConf.WriteNum("y", static_cast<short>(y())); |
| | 2891 | licqConf.WriteNum("h", (unsigned short)(size().height() < 0 ? 0 : (m_bInMiniMode ? m_nRealHeight : size().height()))); |
| | 2892 | licqConf.WriteNum("w", (unsigned short)(size().width() < 0 ? 0 : size().width())); |
| | 2893 | |
| | 2894 | #if 0 |
| | 2895 | licqConf.SetSection("floaties"); |
| | 2896 | licqConf.WriteNum("Num", (unsigned short)CUserView::floaties->size()); |
| | 2897 | unsigned short i = 0; |
| | 2898 | char key[32]; |
| | 2899 | for (; i < CUserView::floaties->size(); ) |
| | 2900 | { |
| | 2901 | CUserView* iter = CUserView::floaties->at(i); |
| | 2902 | sprintf(key, "Floaty%d.Ppid", i); |
| | 2903 | licqConf.WriteNum(key, static_cast<CUserViewItem*>(iter->firstChild())->ItemPPID()); |
| | 2904 | sprintf(key, "Floaty%d.Uin", i); |
| | 2905 | licqConf.WriteStr(key, static_cast<CUserViewItem*>(iter->firstChild())->ItemId()); |
| | 2906 | sprintf(key, "Floaty%d.X", i); |
| | 2907 | licqConf.WriteNum(key, (unsigned short)(iter->x() > 0 ? iter->x() : 0)); |
| | 2908 | sprintf(key, "Floaty%d.Y", i); |
| | 2909 | licqConf.WriteNum(key, (unsigned short)(iter->y() > 0 ? iter->y() : 0)); |
| | 2910 | sprintf(key, "Floaty%d.W", i); |
| | 2911 | licqConf.WriteNum(key, (unsigned short)iter->width()); |
| | 2912 | i++; |
| | 2913 | } |
| | 2914 | #endif |
| | 2915 | |
| | 2916 | licqConf.FlushFile(); |
| | 2917 | licqConf.CloseFile(); |
| | 2918 | } |
| | 2919 | |